Buffer Overflow occurs when a write exceeds an allocated buffer, overwriting adjacent memory: return address, pointers, variables.
Types
- Stack-based — overwrite return address → RIP/EIP control.
- Heap-based — corrupt allocator metadata (chunk headers).
- Off-by-one — overwrite a single byte.
Mitigations
ASLR, Stack Canaries, NX/DEP, Safe Stack, AddressSanitizer.