CWE-121: Stack-based Buffer Overflow

low-risk

A stack-based buffer overflow condition is a condition where the buffer being overwritten is allocated on the stack (i.e., is a local variable or, rarely, a parameter to a function).

Abstraction: Variant

Common Consequences

Availability Modify Memory
Integrity Modify Memory
Integrity Modify Memory

Detection Methods

Fuzzing

Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs - either randomly or algorithmically - and dynamically invoking the code with those inputs. Even with random inputs, it is often capable of generating unexpected results such as crashes, memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases that clearly indicate bugs, which helps developers to diagnose the issues.

Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Automated Dynamic Analysis

Use tools that are integrated during compilation to insert runtime error-checking mechanisms related to memory safety errors, such as AddressSanitizer (ASan) for C/C++ [REF-1518].

Real-World Examples (10)

CVE CVSS EPSS KEV
CVE-2021-20038 9.8 94.3% Y
CVE-2025-0282 9.0 94.1% Y
CVE-2009-0927 8.8 93.3% Y
CVE-2022-20699 10.0 89.9% Y
CVE-2021-33549 7.2 89.0%
CVE-2016-6563 9.8 84.9%
CVE-2008-0015 8.8 83.2% Y
CVE-2022-20707 10.0 81.4%
CVE-2024-27130 7.2 81.0%
CVE-2022-20705 10.0 80.2%
6
/ 100
low-risk
Active Threat 5/50 · Minimal
Exploit Availability 1/50 · Minimal