Defenses Preview (full treatment in Class 05)
- Stack canaries (StackGuard): a secret value placed before the saved return address; checked on return. A linear overflow corrupts it and the program aborts.
- ASLR: randomizes the base of the stack, heap, libraries, and (with PIE) the binary — attacker no longer knows fixed addresses.
- NX / DEP: marks the stack non-executable, so injected shellcode on the stack will not run (motivates code-reuse attacks like ret2win / ROP).
- Our lab binaries disable these so the core mechanic is visible; real systems enable all three.
Key Takeaway
Modern defenses do not make overflows harmless — they raise the bar. We enable them by default and study bypasses to understand residual risk.