-
January 7th, 2004, 08:18 PM
#1
format string %n vulnerability
Ive been reading some safe programming techniques and theres a section on fromat strings.
basically is says that keep format strings like this out
printf(user);
//where user was supplied by the user from the command line
it says this can be expoitable or crashable with %n
Ive never really used the %n can someone tell me what that is and how that could make a program exploitable
That which does not kill me makes me stronger -- Friedrich Nietzche
-
January 7th, 2004, 08:41 PM
#2
The mentally handicaped are persecuted in this great country, and I say rightfully so! These people are NUTS!!!!
-
January 7th, 2004, 08:53 PM
#3
well I actually did search google already and did not get what I wanted. The problem with google is that when I put %n it doesnt respect the the % I even tried "%n" or "\%n" but I get a ton of google pages with just \n
So thats kinda why I posted here
maybe my question should have been using google how do i make sure the string '%n' is searched for
also I looked at the man page for printf and theres really nothing about %n
Also Im not just looking for what the vulnerablity is but also about what %n does with printf
That which does not kill me makes me stronger -- Friedrich Nietzche
-
January 8th, 2004, 01:53 AM
#4
This is a PDF white paper touting FormatGuard, but it contains some good information on Printf vulnerabilities.
http://www.immunix.org/formatguard.pdf
The mentally handicaped are persecuted in this great country, and I say rightfully so! These people are NUTS!!!!
-
January 8th, 2004, 02:24 AM
#5
This is a fairly complex exploit method, but alas I will attempt to get to the crux of the matter. The "%n" format string writes the number of bytes already printed to a variable, which in itself is not a bad thing but this is the meat of a pure format string vuln. Without the "%n" or combining a format vuln with another technique (standard overflow) you are limited to reading memory only, granted you can read just about ANY memory you want which is pretty disasterous already but the "%n" actually WRITES to an address which is placed on the stack as a parameter (yipee!) and allows a savy coder to perform some very ingenious trickery in order to write the desired data to an arbitrary location in memory (of course writting to unmapped memory wont turn out well.). Of course this isnt the only format parameter used, the others %d %s %x %u are all used to adjust the stack pointer according to the coders purpose by abusing how format strings and their parameters are stored on the stack.
-Maestr0
\"If computers are to become smart enough to design their own successors, initiating a process that will lead to God-like omniscience after a number of ever swifter passages from one generation of computers to the next, someone is going to have to write the software that gets the process going, and humans have given absolutely no evidence of being able to write such software.\" -Jaron Lanier
-
January 8th, 2004, 02:39 AM
#6
Member
even though i have used printf often, i didn't realize there are vulnerabilities..
hmm.. i think i'll try to explore it.. thanks for da info..
-
January 8th, 2004, 04:56 PM
#7
You should probably read this paper by team Teso.
Also check out this post by The_Jinx.
Oliver's Law:
Experience is something you don't get until just after you need it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|