Buffer Overflow
A buffer overflow occurs when a program writes more data into a fixed-size buffer than it can hold, overwriting adjacent memory and potentially causing crashes or code execution.
Purpose
To understand and defend against memory-safety vulnerabilities, the most common type of security defect in C/C++ programs.
Mechanism
Writing more bytes than the allocated length into a stack/heap buffer overwrites adjacent memory (return addresses, other variables). An attacker can overwrite a return address to jump to shellcode. Defenses: bounds checking, ASLR, stack canaries, DEP/NX.
Use cases
- C/C++ security audit
- Exploit analysis
- Memory safety defense