6 ms·
I'm curious about this, didn't know about %n before. What are the common pitfalls and exploits using this enables?
by greiskul 2y ago
I'm curious about this, didn't know about %n before. What are the common pitfalls and exploits using this enables?
- lights0123 2y agoIf the user can control the formatting string, they can write to pointers stored on the stack. It's important to use printf("%s", str) instead of printf(str).
- mananaysiempre 2y agoYou would expect a printf call with a user-controlled format string to be, at worst, an arbitrary read. Thanks to %n, it can be a write as well.