CWE
CWE/SANS Top 25 Most Dangerous Software Errors Common Weakness Scoring System
Common Weakness Risk Analysis Framework
Home > CWE List > CWE- Individual Dictionary Definition (2.4)  

CWE-787: Out-of-bounds Write

 
Out-of-bounds Write
Weakness ID: 787 (Weakness Base)Status: Incomplete
+ Description

Description Summary

The software writes data past the end, or before the beginning, of the intended buffer.

Extended Description

This typically occurs when the pointer or its index is incremented or decremented to a position beyond the bounds of the buffer or when pointer arithmetic results in a position outside of the valid memory location to name a few. This may result in corruption of sensitive information, a crash, or code execution among other things.

+ Common Consequences
ScopeEffect
Integrity
Availability
Confidentiality

Technical Impact: Modify memory; DoS: crash / exit / restart; Execute unauthorized code or commands

+ Demonstrative Examples

Example 1

The following code attempts to save four different identification numbers into an array.

(Bad Code)
Example Language:
int id_sequence[3];

/* Populate the id array. */

id_sequence[0] = 123;
id_sequence[1] = 234;
id_sequence[2] = 345;
id_sequence[3] = 456;
+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfWeakness ClassWeakness Class119Improper Restriction of Operations within the Bounds of a Memory Buffer
Development Concepts (primary)699
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness Variant121Stack-based Buffer Overflow
Development Concepts699
Research Concepts1000
ParentOfWeakness VariantWeakness Variant122Heap-based Buffer Overflow
Development Concepts699
Research Concepts1000
ParentOfWeakness BaseWeakness Base124Buffer Underwrite ('Buffer Underflow')
Development Concepts699
Research Concepts1000
CanFollowWeakness BaseWeakness Base822Untrusted Pointer Dereference
Research Concepts1000
CanFollowWeakness BaseWeakness Base823Use of Out-of-range Pointer Offset
Research Concepts1000
CanFollowWeakness BaseWeakness Base824Access of Uninitialized Pointer
Research Concepts1000
CanFollowWeakness BaseWeakness Base825Expired Pointer Dereference
Research Concepts1000
+ Content History
Submissions
Submission DateSubmitterOrganizationSource
2009-10-21MITREInternal CWE Team
Modifications
Modification DateModifierOrganizationSource
2010-02-16CWE Content TeamMITREInternal
updated Demonstrative_Examples
2010-09-27CWE Content TeamMITREInternal
updated Relationships
2011-06-01CWE Content TeamMITREInternal
updated Common_Consequences
Page Last Updated: February 20, 2013