While a pointer can contain a reference to any arbitrary memory location, a program typically only intends to use the pointer to access limited portions of memory, such as contiguous memory used to access an individual array.
Programs may use offsets in order to access fields or sub-elements stored within structured data. The offset might be out-of-range if it comes from an untrusted source, is the result of an incorrect calculation, or occurs because of another error.
If an attacker can control or influence the offset so that it points outside of the intended boundaries of the structure, then the attacker may be able to read or write to memory locations that are used elsewhere in the product. As a result, the attack might change the state of the product as accessed through program variables, cause a crash or instable behavior, and possibly lead to code execution.
| Impact | Details |
|---|---|
|
Read Memory |
Scope: Confidentiality
If the untrusted pointer is used in a read operation, an attacker might be able to read sensitive portions of memory.
|
|
DoS: Crash, Exit, or Restart |
Scope: Availability
If the untrusted pointer references a memory location that is not accessible to the program, or points to a location that is "malformed" or larger than expected by a read or write operation, the application may terminate unexpectedly.
|
|
Execute Unauthorized Code or Commands; Modify Memory |
Scope: Integrity, Confidentiality, Availability
If the untrusted pointer is used in a function call, or points to unexpected data in a write operation, then code execution may be possible.
|
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf | Class Class - a weakness that is described in a very abstract fashion, typically independent of any specific language or technology. More specific than a Pillar Weakness, but more general than a Base Weakness. Class level weaknesses typically describe issues in terms of 1 or 2 of the following dimensions: behavior, property, and resource. | 119 | Improper Restriction of Operations within the Bounds of a Memory Buffer |
| CanFollow | Variant Variant - a weakness that is linked to a certain type of product, typically involving a specific language or technology. More specific than a Base weakness. Variant level weaknesses typically describe issues in terms of 3 to 5 of the following dimensions: behavior, property, technology, language, and resource. | 129 | Improper Validation of Array Index |
| CanPrecede | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 125 | Out-of-bounds Read |
| CanPrecede | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 787 | Out-of-bounds Write |
| Nature | Type | ID | Name |
|---|---|---|---|
| MemberOf | Category Category - a CWE entry that contains a set of other entries that share a common characteristic. | 465 | Pointer Issues |
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf | Class Class - a weakness that is described in a very abstract fashion, typically independent of any specific language or technology. More specific than a Pillar Weakness, but more general than a Base Weakness. Class level weaknesses typically describe issues in terms of 1 or 2 of the following dimensions: behavior, property, and resource. | 119 | Improper Restriction of Operations within the Bounds of a Memory Buffer |
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf | Class Class - a weakness that is described in a very abstract fashion, typically independent of any specific language or technology. More specific than a Pillar Weakness, but more general than a Base Weakness. Class level weaknesses typically describe issues in terms of 1 or 2 of the following dimensions: behavior, property, and resource. | 119 | Improper Restriction of Operations within the Bounds of a Memory Buffer |
Note: this is a curated list of examples for users to understand the variety of ways in which this weakness can be introduced. It is not a complete list of all CVEs that are related to this CWE entry.
| Reference | Description |
|---|---|
|
Invalid offset in undocumented opcode leads to memory corruption.
|
|
|
Multimedia player uses untrusted value from a file when using file-pointer calculations.
|
|
|
Spreadsheet program processes a record with an invalid size field, which is later used as an offset.
|
|
|
Instant messaging library does not validate an offset value specified in a packet.
|
|
|
Language interpreter does not properly handle invalid offsets in JPEG image, leading to out-of-bounds memory access and crash.
|
|
|
negative offset leads to out-of-bounds read
|
|
|
untrusted offset in kernel
|
|
|
"blind trust" of an offset value while writing heap memory allows corruption of function pointer,leading to code execution
|
|
|
negative value (signed) causes pointer miscalculation
|
|
|
signed values cause incorrect pointer calculation
|
|
|
values used as pointer offsets
|
|
|
a return value from a function is sign-extended if the value is signed, then used as an offset for pointer arithmetic
|
|
|
portions of a GIF image used as offsets, causing corruption of an object pointer.
|
|
|
invalid numeric field leads to a free of arbitrary memory locations, then code execution.
|
|
|
large number of elements leads to a free of an arbitrary address
|
|
|
array index issue (CWE-129) with negative offset, used to dereference a function pointer
|
|
|
"buffer seek" value - basically an offset?
|
| Method | Details |
|---|---|
|
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.)
Effectiveness: High |
| Nature | Type | ID | Name |
|---|---|---|---|
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1399 | Comprehensive Categorization: Memory Safety |
Rationale
This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.Comments
Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.Terminology
Maintenance
| CAPEC-ID | Attack Pattern Name |
|---|---|
| CAPEC-129 | Pointer Manipulation |
| Submissions | ||
|---|---|---|
| Submission Date | Submitter | Organization |
|
2010年09月22日
(CWE 1.10, 2010年09月27日) |
CWE Content Team | MITRE |
| Modifications | ||
| Modification Date | Modifier | Organization |
|
2025年09月09日
(CWE 4.18, 2025年09月09日) |
CWE Content Team | MITRE |
| updated Affected_Resources, Functional_Areas | ||
| 2023年06月29日 | CWE Content Team | MITRE |
| updated Mapping_Notes | ||
| 2023年04月27日 | CWE Content Team | MITRE |
| updated Detection_Factors, Relationships | ||
| 2023年01月31日 | CWE Content Team | MITRE |
| updated Description | ||
| 2022年04月28日 | CWE Content Team | MITRE |
| updated Research_Gaps | ||
| 2020年12月10日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2020年08月20日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2020年02月24日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2019年06月20日 | CWE Content Team | MITRE |
| updated Related_Attack_Patterns | ||
| 2012年05月11日 | CWE Content Team | MITRE |
| updated References | ||
| 2011年06月01日 | CWE Content Team | MITRE |
| updated Common_Consequences | ||
Use of the Common Weakness Enumeration (CWE™) and the associated references from this website are subject to the Terms of Use. CWE is sponsored by the U.S. Department of Homeland Security (DHS) Cybersecurity and Infrastructure Security Agency (CISA) and managed by the Homeland Security Systems Engineering and Development Institute (HSSEDI) which is operated by The MITRE Corporation (MITRE). Copyright © 2006–2025, The MITRE Corporation. CWE, CWSS, CWRAF, and the CWE logo are trademarks of The MITRE Corporation.