Buffer Underwrite ('Buffer Underflow') |
Weakness ID: 124 (Weakness Base) | Status: Incomplete |
Description Summary
Extended Description
This typically occurs when a pointer or its index is decremented to a position before the buffer, when pointer arithmetic results in a position before the beginning of the valid memory location, or when a negative index is used.
buffer underrun: | Some prominent vendors and researchers use the term "buffer underrun". "Buffer underflow" is more commonly used, although both terms are also sometimes used to describe a buffer under-read (CWE-127). |
---|
Scope | Effect |
---|---|
Availability | Out of bounds memory access will very likely result in the corruption of relevant memory, and perhaps instructions, possibly leading to a crash. |
Access Control | 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 how the affected data is used, such as an adjacent memory location that is used to specify whether the user has special privileges. |
Other | When the consequence is arbitrary code execution, this can often be used to subvert any other security service. |
Example 1
The following is an example of code that may result in a buffer underwrite, if find() returns a negative value to indicate that ch is not found in srcBuf:
If the index to srcBuf is somehow under user control, this is an arbitrary write-what-where condition.
Reference | Description |
---|---|
CVE-2002-2227 | Unchecked length of SSLv2 challenge value leads to buffer underflow. |
CVE-2007-4580 | Buffer underflow from a small size value with a large buffer (length parameter inconsistency, CWE-130) |
CVE-2007-1584 | Buffer underflow from an all-whitespace string, which causes a counter to be decremented before the buffer while looking for a non-whitespace character. |
CVE-2007-0886 | Buffer underflow resultant from encoded data that triggers an integer overflow. |
CVE-2006-6171 | Product sets an incorrect buffer size limit, leading to "off-by-two" buffer underflow. |
CVE-2006-4024 | Negative value is used in a memcpy() operation, leading to buffer underflow. |
CVE-2004-2620 | Buffer underflow due to mishandled special characters |
Requirements specification: The choice could be made to use a language that is not susceptible to these issues. |
Phase: Implementation Sanity checks should be performed on all calculated values used as index or for pointer arithmetic. |
Ordinality | Description |
---|---|
Primary | (where the weakness exists independent of other weaknesses) |
Nature | Type | ID | Name | View(s) this relationship pertains to |
---|---|---|---|---|
ChildOf | Weakness Base | 786 | Access of Memory Location Before Start of Buffer | Development Concepts (primary)699 Research Concepts (primary)1000 |
ChildOf | Weakness Base | 787 | Out-of-bounds Write | Development Concepts699 Research Concepts1000 |
PeerOf | Weakness Base | 120 | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | Research Concepts1000 |
PeerOf | Weakness Base | 129 | Improper Validation of Array Index | Research Concepts1000 |
CanAlsoBe | Weakness Variant | 196 | Unsigned to Signed Conversion Error | Research Concepts1000 |
This could be resultant from several errors, including a bad offset or an array index that decrements before the beginning of the buffer (see CWE-129). |
Much attention has been paid to buffer overflows, but "underflows" sometimes exist in products that are relatively free of overflows, so it is likely that this variant has been under-studied. |
Mapped Taxonomy Name | Node ID | Fit | Mapped Node Name |
---|---|---|---|
PLOVER | UNDER - Boundary beginning violation ('buffer underflow'?) | ||
CLASP | Buffer underwrite |
"Buffer UNDERFLOWS: What do you know about it?". Vuln-Dev Mailing List. 2004-01-10. <http://seclists.org/vuln-dev/2004/Jan/0022.html>. |
Submissions | ||||
---|---|---|---|---|
Submission Date | Submitter | Organization | Source | |
PLOVER | Externally Mined | |||
Modifications | ||||
Modification Date | Modifier | Organization | Source | |
2008-07-01 | Eric Dalci | Cigital | External | |
updated Time of Introduction | ||||
2008-09-08 | CWE Content Team | MITRE | Internal | |
updated Alternate Terms, Applicable Platforms, Common Consequences, Description, Relationships, Relationship Notes, Taxonomy Mappings, Weakness Ordinalities | ||||
2009-01-12 | CWE Content Team | MITRE | Internal | |
updated Common Consequences | ||||
2009-10-29 | CWE Content Team | MITRE | Internal | |
updated Description, Name, Relationships | ||||
Previous Entry Names | ||||
Change Date | Previous Entry Name | |||
2009-10-29 | Boundary Beginning Violation ('Buffer Underwrite') | |||