CWEweakness

CWE-121 Stack-based Buffer Overflow

High Official page ↗
Alternate terms
Stack Overflow, Stack Buffer Overflow
Abstraction
Variant
Structure
Simple
Status
Draft
Likelihood of exploit
High
Languages
C, C++, Memory-Unsafe
CWE version
5.0

Description

The product writes past the end of a buffer that was allocated on the stack.

Common consequences

• Availability: Modify Memory, DoS: Crash, Exit, or Restart, DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory) — Buffer overflows generally lead to crashes. Other attacks leading to lack of availability are possible, including putting the program into an infinite loop. • Integrity, Confidentiality, Availability, Access Control: Modify Memory, Execute Unauthorized Code or Commands, Bypass Protection Mechanism — Buffer overflows often can be used to execute arbitrary code, which is usually outside the scope of a program's implicit security policy. • Integrity, Confidentiality, Availability, Access Control, Other: Modify Memory, Execute Unauthorized Code or Commands, Bypass Protection Mechanism, Other — When the consequence is arbitrary code execution, this can often be used to subvert any other security service.

Potential mitigations

• [Operation, Build and Compilation] Use automatic buffer overflow detection mechanisms that are offered by certain compilers or compiler extensions. Examples include: the Microsoft Visual Studio /GS flag, Fedora/Red Hat FORTIFY_SOURCE GCC flag, StackGuard, and ProPolice, which provide various mechanisms including canary-based detection and range/index checking. D3-SFCV (Stack Frame Canary Validation) from D3FEND [REF-1334] discusses canary-based detection in detail. • [Architecture and Design] Use an abstraction library to abstract away risky APIs. Not a complete solution. • [Implementation] Implement and perform bounds checking on input. • [Implementation] Do not use dangerous functions such as gets. Use safer, equivalent functions which check for boundary errors. • [Operation, Build and Compilation] Run or compile the software using features or extensions that randomly arrange the positions of a program's executable and libraries in memory. Because this makes the addresses unpredictable, it can prevent an attacker from reliably jumping to exploitable code. Examples include Address Space Layout Randomization (ASLR) [REF-58] [REF-60] and Position-Independent Executables (PIE) [REF-64]. Imported modules may be similarly realigned if their default memory addresses conflict with other modules, in a process known as "rebasing" (for Windows) and "prelinking" (for Linux) [REF-1332] using randomly generated addresses. ASLR for libraries cannot be used in conjunction with prelink since it would require relocating the libraries at run-time, defeating the whole purpose of prelinking. For more information on these techniques see D3-SAOR (Segment Address Offset Randomization) from D3FEND [REF-1335].

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].

Observed examples

• CVE-2021-35395: Stack-based buffer overflows in SFK for wifi chipset used for IoT/embedded devices, as exploited in the wild per CISA KEV.

Related

Observed example · CVE (1)

  • CVE-2021-35395 Realtek Jungle SDK version v2.x up to v3.4.14B provides an HTTP web server exposing a management interface that can be used to configure… vulnerability

Child of · CWE (2)

  • CWE-787 Out-of-bounds Write weakness
  • CWE-788 Access of Memory Location After End of Buffer weakness

Referenced by CVE · weakness (4,076)

  • CVE-2026-103408 A Stack Buffer Overflow vulnerability in the DHCP client in Juniper Networks Session Smart Router allows an unauthenticated attacker on the… vulnerability
  • CVE-2026-103780 Dell PowerProtect Data Domain, Feature Release versions 7.7.1.0 through 8.8, LTS2024 release versions 7.13.1.0 through 7.13.1.80, LTS2025… vulnerability
  • CVE-2026-117609 rtl_433 through 25.12 contains a stack-based buffer overflow vulnerability in proflame2_mc() that allows nearby attackers to write past a… vulnerability
  • CVE-2026-118603 Alpine iLX-F511 vCard Parsing Stack-based Buffer Overflow Remote Code Execution Vulnerability. vulnerability
  • CVE-2026-118604 Alpine iLX-F511 Framework Service Stack-based Buffer Overflow Remote Code Execution Vulnerability. vulnerability
  • CVE-2026-118605 Alpine iLX-F511 prh_sdp_service_search_decode Stack-based Buffer Overflow Remote Code Execution Vulnerability. vulnerability
  • CVE-2026-118609 Alpine iLX-F511 Android Auto Connection Handler Stack-based Buffer Overflow Remote Code Execution Vulnerability. vulnerability
  • CVE-2026-118610 Alpine iLX-F511 Android Auto Service Stack-based Buffer Overflow Remote Code Execution Vulnerability. vulnerability
  • CVE-2026-86378 Dell PowerProtect Data Domain, Feature Release versions 7.7.1.0 through 8.8, LTS2024 release versions 7.13.1.0 through 7.13.1.80, LTS2025… vulnerability
  • CVE-2026-103593 A stack-based buffer overflow vulnerability in the Fireware OS logging service allows a network-adjacent attacker who can impersonate or… vulnerability
  • CVE-2026-103594 A stack-based buffer overflow vulnerability in Fireware OS's WireGuard configuration processing allows a remote attacker that has… vulnerability
  • CVE-2026-111548 A stack-based buffer overflow vulnerability exists in the web management interface of affected Moxa wireless device servers. vulnerability
  • CVE-2026-113881 A stack-based buffer overflow vulnerability in Fireware OS's VPN Network Access Enforcement process allows an authenticated mobile VPN user… vulnerability
  • CVE-2026-48379 Substance3D - Painter is affected by a Stack-based Buffer Overflow vulnerability that could result in arbitrary code execution in the… vulnerability
  • CVE-2026-76932 Stack-based Buffer Overflow Vulnerability in JP1/Automatic Job Management System 3. vulnerability
  • CVE-2026-76934 Stack-based Buffer Overflow Vulnerability in JP1/Automatic Job Management System 3. vulnerability
  • CVE-2026-76935 Stack-based Buffer Overflow Vulnerability in JP1/Automatic Job Management System 3. vulnerability
  • CVE-2026-76936 Stack-based Buffer Overflow Vulnerability in JP1/Automatic Job Management System 3. vulnerability
  • CVE-2026-82118 Stack-based Buffer Overflow Vulnerability in HiRDB. vulnerability
  • CVE-2026-82122 Stack-based Buffer Overflow Vulnerability in HiRDB. vulnerability
  • CVE-2026-86575 Stack-based Buffer Overflow Vulnerability in JP1 Products. vulnerability
  • CVE-2026-90442 A stack-based buffer overflow vulnerability in the Fireware OS certd process allows an authenticated attacker with access to the Firebox… vulnerability
  • CVE-2026-90725 Dell PowerProtect Data Domain, Feature Release versions 7.7.1.0 through 8.8, LTS2024 release versions 7.13.1.0 through 7.13.1.80, LTS2025… vulnerability
  • CVE-2026-90731 Dell PowerProtect Data Domain, Feature Release versions 7.7.1.0 through 8.7, LTS2024 release versions 7.13.1.0 through 7.13.1.80, LTS2025… vulnerability
  • CVE-2026-90732 Dell PowerProtect Data Domain, Feature Release versions 7.7.1.0 through LTS 2026, LTS2024 release versions 7.13.1.0 through 7.13.1.80,… vulnerability
  • CVE-2026-93857 A stack-based buffer overflow vulnerability in Fireware OS's SIP proxy allows a remote, unauthenticated attacker to execute arbitrary code… vulnerability
  • CVE-2026-107894 V-SFT provided by FUJI ELECTRIC CO., LTD. vulnerability
  • CVE-2026-116508 A security flaw has been discovered in TOTOLINK A950RG 4.1.2cu.5268_B20221104. vulnerability
  • CVE-2026-116723 FLTK through 1.4.5 contains a stack-based buffer overflow vulnerability in Fl_BMP_Image::load_bmp_() that allows attackers to corrupt stack… vulnerability
  • CVE-2026-116738 VMime through 0.9.2 contains an integer underflow in the uuEncoder::decode function that allows remote attackers to trigger a stack-based… vulnerability
Show all 4,076 ›

Referenced by CWE · has member (1)

  • CWE-1435 Weaknesses in the 2025 CWE Top 25 Most Dangerous Software Weaknesses view

Referenced by OWASP · mapped cwe (1)