logo

CWE-122 - Heap-based Buffer Overflow

CWE-122 High

  • Abstraction:
  • Variant
  • Structure:
  • Simple
  • Status:
  • Draft
Weakness Name

Heap-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

Scope: Availability

Impact: DoS: Crash, Exit, or Restart, DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory)

Notes: Buffer overflows generally lead to crashes. Other attacks leading to lack of availability are possible, including putting the program into an infinite loop.

Scope: Integrity, Confidentiality, Availability, Access Control

Impact: Execute Unauthorized Code or Commands, Bypass Protection Mechanism, Modify Memory

Notes: Buffer 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 be living in memory, pointing it to the attacker's code. Even in applications that do not explicitly use function pointers, the run-time will usually leave many in memory. For example, object methods in C++ are generally implemented using function pointers. Even in C programs, there is often a global offset table used by the underlying runtime.

Scope: Integrity, Confidentiality, Availability, Access Control, Other

Impact: Execute Unauthorized Code or Commands, Bypass Protection Mechanism, Other

Notes: When the consequence is arbitrary code execution, this can often be used to subvert any other security service.

Related Weaknesses
  • Release Date:
  • 2006-07-19
  • Latest Modification Date:
  • 2024-02-29

Free security scan for your website