CWE•Variant•Draft•20 recent CVEs
CWE-122Heap-based Buffer Overflow
Description
A heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc().
Common consequences
- Availability→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→Execute Unauthorized Code or Commands,Bypass Protection Mechanism,Modify MemoryBuffer overflows often can be used to execute arbitrary code, which is usually outside the scope of a program's implicit security policy. Besides important user data, heap-based overflows can be used to overwrite function pointers that may
- Integrity,Confidentiality,Availability,Access Control,Other→Execute Unauthorized Code or Commands,Bypass Protection Mechanism,OtherWhen the consequence is arbitrary code execution, this can often be used to subvert any other security service.
Potential mitigations
- Pre-design: Use a language or compiler that performs automatic bounds checking.
- Architecture and DesignUse an abstraction library to abstract away risky APIs. Not a complete solution.
- Operation,Build and Compilation[object Object]
- Operation,Build and Compilation[object Object]
- ImplementationImplement and perform bounds checking on input.
- ImplementationDo not use dangerous functions such as gets. Look for their safe equivalent, which checks for the boundary.
- OperationUse OS-level preventative functionality. This is not a complete solution, but it provides some defense in depth.
Related CWEs
Recent CVEs classified under this CWE
CVE-2026-179512026-07-30CVE-2026-179352026-07-30CVE-2026-177582026-07-30CVE-2026-176802026-07-30CVE-2026-133076.82026-07-29CVE-2026-142667.02026-07-29CVE-2026-671919.82026-07-29CVE-2026-164637.82026-07-29CVE-2026-483727.82026-07-28CVE-2026-512758.82026-07-28CVE-2026-512748.82026-07-28CVE-2026-512737.82026-07-28CVE-2026-512719.62026-07-28CVE-2026-512698.82026-07-28CVE-2026-512679.82026-07-28CVE-2026-512669.82026-07-28CVE-2026-512639.82026-07-28CVE-2026-512609.42026-07-28CVE-2026-512599.82026-07-28CVE-2026-512358.82026-07-27