CWE-124 — Buffer Underwrite ('Buffer Underflow')
CWE-124: Buffer Underwrite ('Buffer Underflow')
MITRE CWE weakness
| Kind | Weakness |
| Abstraction | Base |
| Status | Incomplete |
| Likelihood of exploit | Medium |
Description
The product writes to a buffer using an index or pointer that references a memory location prior to the beginning of the buffer.
Common consequences
- Integrity, Availability: Modify Memory, DoS: Crash, Exit, or Restart
- Integrity, Confidentiality, Availability, Access Control, Other: Execute Unauthorized Code or Commands, Modify Memory, Bypass Protection Mechanism, Other
- Access Control, Other: Bypass Protection Mechanism, Other
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.
References
- CWE page: https://cwe.mitre.org/data/definitions/124.html
- CWE list: https://cwe.mitre.org/data/index.html