Buffer overflow
A flaw where a program writes more data into a memory buffer than it can hold, overwriting adjacent memory, which can crash the program or let an attacker run code.
Full guide: Buffer Overflow and the Stack Canary Explained for CISSP
A buffer overflow happens when a program copies data into a fixed-size region of memory without checking that it fits, so the excess spills into whatever lies next to it. The root cause is missing bounds checking, most often in languages such as C and C++ that leave memory management to the programmer. MITRE’s Common Weakness Enumeration tracks the family under entries such as CWE-120 and CWE-787 (out-of-bounds write).
The consequences depend on what is overwritten. On the stack, an overflow can reach a function’s saved return address, so that execution jumps where the attacker chose. On the heap, it can corrupt structures the program later trusts. The mildest result is often a crash, a denial of service; the worst is code execution with the program’s privileges, and so potential privilege escalation. The primary fix is in the code: a bounds check on every write against the destination’s size, bounded copy functions in place of unbounded ones, and memory-safe languages for new work, with input validation as a supporting layer. Platform defences reduce exploitability: stack canaries detect an overwritten return address, data execution prevention stops injected code running, and ASLR hides where targets sit.
Exam relevance: a scenario in which oversized input crashes a service or yields code execution is likely to describe a buffer overflow. Candidates are expected to name bounds checking as the root-cause remedy and to treat canaries, DEP and ASLR as mitigations layered on top.