📜 BrainStuffer
Format String Playground
Simulate printf(user_input) — stack leaks with %p/%x, write primitive with %n
Format String (what the attacker controls)
Presets
Simulated Stack (printf argument slots)
Read (%p/%x/%d/%s) Write (%n)
#AddressValueNotes
printf() Output
⚠️ WRITE PRIMITIVE

How this becomes an exploit:
The vulnerable code is printf(buf) instead of printf("%s", buf). Each %p or %x reads the next 8/4 bytes off the stack — leaking addresses, canaries, or pointers into libc. %N$p lets you reach the Nth argument directly (direct parameter access). The killer: %n writes the number of characters printed so far into the address held by the next argument slot — turning a read-primitive into an arbitrary write. Combined with %Nc padding to control the written value, you can overwrite a GOT entry or return address.

← Back to Interactive Learning