3 ms·
> if you (the attacker) receive the printf output This is a luxury that not all of us have ;) > you can then use %N$n to write to any pointer in memory - if y
by saagarjha 9y ago
> if you (the attacker) receive the printf output
This is a luxury that not all of us have ;)
> you can then use %N$n to write to any pointer in memory - if you can find your input string in memory (dereference stuff until you find the heap, for example), you can stuff pointers into it
You first have to get a valid pointer to something, which can be pretty hard when the addresses are randomized. Yes: if you can satisfy all the requirements for a printf attack, there's a whole lot you can do: overflow the stack and write to the return address, find the address of system, perform arbitrary reads or writes, etc. But as you've mentioned yourself, a successful format string exploit requires more than just "someone passed a user-controlled string to printf", at least as far as I'm aware.
- tgb 9y agoIn this context, we did get the sprintf output - it was the chat functionality of a video game and that's how I knew anything was amiss.