CWE-124: Buffer Underwrite ('Buffer Underflow')
Description
The product writes to a buffer using an index or pointer that references a memory location prior to the beginning of the buffer.
- Abstraction
- BaseA weakness specific enough to point to detection and prevention methods.
- Likelihood of exploit
- Medium
- Status
- Incomplete
Common consequences
- IntegrityAvailability
Modify Memory; DoS: Crash, Exit, or Restart
Out of bounds memory access will very likely result in the corruption of relevant memory, and perhaps instructions, possibly leading to a crash.
- IntegrityConfidentialityAvailabilityAccess ControlOther
Execute Unauthorized Code or Commands; Modify Memory; Bypass Protection Mechanism; Other
If the corrupted memory can be effectively controlled, it may be possible to execute arbitrary code. If the corrupted memory is data rather than instructions, the system will continue to function with improper changes, possibly in violation of an implicit or explicit policy. The consequences would only be limited by...
- Access ControlOther
Bypass Protection Mechanism; Other
When the consequence is arbitrary code execution, this can often be used to subvert any other security service.
Potential mitigations
- Requirements
Choose a language that is not susceptible to these issues.
- Implementation
All calculated values that are used as index or for pointer arithmetic should be validated to ensure that they are within an expected range.
Related weaknesses
CAPEC attack patterns that exploit it
CWE 4.20 links no CAPEC attack pattern to this weakness.