CWEweakness

CWE-587 Assignment of a Fixed Address to a Pointer

Official page ↗
Abstraction
Variant
Structure
Simple
Status
Draft
Languages
Assembly, C, C#, C++, Memory-Unsafe
CWE version
5.0

Description

The product sets a pointer to a specific address other than NULL or 0.

Common consequences

• Integrity, Confidentiality, Availability: Execute Unauthorized Code or Commands — If one executes code at a known location, an attacker might be able to inject code there beforehand. • Availability: DoS: Crash, Exit, or Restart, Reduce Maintainability, Reduce Reliability — If the code is ported to another platform or environment, the pointer is likely to be invalid and cause a crash. • Confidentiality, Integrity: Read Memory, Modify Memory — The data at a known pointer location can be easily read or influenced by an attacker.

Potential mitigations

• [Implementation] Never set a pointer to a fixed address.

Detection methods

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

Related

Child of · CWE (2)

  • CWE-344 Use of Invariant Value in Dynamically Changing Context weakness
  • CWE-758 Reliance on Undefined, Unspecified, or Implementation-Defined Behavior weakness

Referenced by CVE · weakness (1)

  • CVE-2021-28216 BootPerformanceTable pointer is read from an NVRAM variable in PEI. vulnerability

Referenced by CWE · has member (1)