Also known as: buffer overrun · stack overflow vulnerability · heap overflow
A buffer overflow is a memory-safety vulnerability in which a program writes more data into a fixed-size memory buffer than it can hold, corrupting adjacent memory and potentially allowing an attacker to alter program execution.
Overflows are categorised by which memory region they corrupt. Stack overflows can overwrite return addresses to redirect execution; heap overflows corrupt allocator metadata or neighbouring objects, typically requiring more sophisticated exploitation.
Buffer overflows are the archetypal memory-safety bug and a primary reason for the industry shift toward memory-safe languages. Mitigations such as stack canaries, ASLR, and non-executable memory raise the difficulty considerably but have all been bypassed in practice.
Memory Safety
Memory safety is the property of a program being unable to access memory outside the bounds of what it legitimately owns, preventing entire vulnerability classes such as buffer overflows, use-after-free, and data races.
Remote Code Execution
Remote code execution (RCE) is a class of vulnerability that allows an attacker to run arbitrary code on a target system over a network, without physical access to that machine.
Exploit
An exploit is code or a technique that takes advantage of a specific vulnerability to cause unintended behaviour, such as executing attacker-supplied code, bypassing authentication, or crashing a service.
Use-After-Free
A use-after-free is a memory-safety vulnerability in which a program continues to use a pointer to memory that has already been released, allowing an attacker who can control what occupies that memory to influence program behaviour.
Rust
Rust is a systems programming language that guarantees memory safety without garbage collection, using a compile-time ownership and borrowing model to eliminate entire classes of bugs including use-after-free and data races.