CWE-587: Assignment of a Fixed Address to a Pointer
Official CWE-587 CWE context with Glexia analysis, remediation guidance, related CVEs, and ATT&CK context.
Glexia's Take
CWE-587: Assignment of a Fixed Address to a Pointer
Assignment of a Fixed Address to a Pointer represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.
Executive Impact
- 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.
Developer Pattern
CWE-587 is the kind of defect developers can usually prevent with explicit validation, safer framework defaults, and tests that exercise hostile input or unsafe state transitions.
Confidence
high confidence from CWE-587, 4.20.
Official CWE Definition
CWE-587: Assignment of a Fixed Address to a Pointer
The product sets a pointer to a specific address other than NULL or 0.
Using a fixed address is not portable, because that address will probably not be valid in all environments or platforms.
Developer And Remediation Guidance
How teams prevent and detect this weakness
Causes
- This code assumes a particular function will always be found at a particular address. It assigns a pointer to that address and calls the function. The same function may not always be found at the same memory address. This could lead to a crash, or an attacker may alter the memory at the expected address, leading to arbitrary code execution.
Remediation
- Implementation: Never set a pointer to a fixed address.
Detection
- 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].
Mappings
Related CVEs, CWEs, and ATT&CK context
Related CWEs
ATT&CK Relevance
ATT&CK relevance is shown only when reviewed or responsibly inferred.