Every function call in a C-style program uses the stack: a strip of memory that grows downward. When foo() calls bar(), the CPU pushes a return address — the instruction to jump back to when bar finishes — right next to the local variables of bar.
Most of those local variables are buffers: fixed-size byte arrays meant to hold input. The classic C functions gets, strcpy, and scanf copy bytes into a buffer without checking its size. Write more bytes than the buffer holds and they spill into adjacent memory — first into other local variables, and then, crucially, into the saved return address.
Overwrite that address with a value the attacker controls, and the CPU will "return" to whatever instruction they choose. That is a buffer overflow exploit: a bug so reliable and so severe that it shaped the entire history of systems security.
The mechanism was known by the 1970s, but the landmark paper by Aleph One, Smashing the Stack for Fun and Profit (Phrack, 1996), made it accessible to a generation of security researchers and attackers alike. The story since then is a race between increasingly clever exploits and increasingly robust defenses.
Comments
Loading comments...