CWE-128 詳細資料

CWE-128

Wrap-around Error
2006-07-19
00h00 +00:00
中危
Incomplete
2026-10-28
00h00 +00:00
指定 CWE 通知
掌握特定 CWE 的任何變更。
管理通知

名稱: Wrap-around Error

Wrap around errors occur whenever a value is incremented past the maximum value for its type and therefore "wraps around" to a very small, negative, or undefined value.

一般資訊

背景詳情

引入方式

Implementation

適用平台

程式語言

名稱: C (Often)
名稱: C++ (Often)

常見後果

範圍 影響 可能性
AvailabilityDoS: Crash, Exit, or Restart, DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory), DoS: Instability

注意:This weakness will generally lead to undefined behavior and therefore crashes. In the case of overflows involving loop index variables, the likelihood of infinite loops is also high.
IntegrityModify Memory

注意:If the value in question is important to data (as opposed to flow), simple data corruption has occurred. Also, if the wrap around results in other conditions such as buffer overflows, further memory corruption may occur.
Confidentiality
Availability
Access Control
Execute Unauthorized Code or Commands, Bypass Protection Mechanism

注意:This weakness can sometimes trigger buffer overflows which can be used to execute arbitrary code. This is usually outside the scope of a program's implicit security policy.

潛在緩解措施

Requirements specification: The choice could be made to use a language that is not susceptible to these issues.
Phases : Architecture and Design
Provide clear upper and lower bounds on the scale of any protocols designed.
Phases : Implementation
Perform validation on all incremented variables to ensure that they remain within reasonable bounds.

偵測方法

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.)
有效性 : High

漏洞對應備注

理由說明 : 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.
備註 : 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.

相關攻擊模式

CAPEC ID 攻擊模式名稱
CAPEC-92 Forced Integer Overflow
This attack forces an integer variable to go out of range. The integer variable is often used as an offset such as size of memory allocation or similarly. The attacker would typically control the value of such variable and try to get it out of range. For instance the integer in question is incremented past the maximum possible value, it may wrap to become a very small, or negative number, therefore providing a very incorrect value which can lead to unexpected behavior. At worst the attacker can execute arbitrary code.

備注

The relationship between overflow and wrap-around needs to be examined more closely, since several entries (including CWE-190) are closely related.

參考資料

REF-44

24 Deadly Sins of Software Security
Michael Howard, David LeBlanc, John Viega.

REF-62

The Art of Software Security Assessment
Mark Dowd, John McDonald, Justin Schuh.

REF-18

The CLASP Application Security Process
Secure Software, Inc..
https://cwe.mitre.org/documents/sources/TheCLASPApplicationSecurityProcess.pdf

REF-1550

Secure PLC Coding Practices: Top 20 List
Secure PLC Programming project.
https://plc-security.com/

提交

名稱 機構 日期 發布日期 Version
CLASP 2006-07-19 +00:00 2006-07-19 +00:00 Draft 3

修改記錄

名稱 機構 日期 備註
CWE Content Team MITRE 2008-09-08 +00:00 updated Applicable_Platforms, Background_Details, Common_Consequences, Relationships, Relationship_Notes, Taxonomy_Mappings, Weakness_Ordinalities
CWE Content Team MITRE 2008-11-24 +00:00 updated Relationships, Taxonomy_Mappings
CWE Content Team MITRE 2009-10-29 +00:00 updated Common_Consequences, Relationships
CWE Content Team MITRE 2010-12-13 +00:00 updated Background_Details
CWE Content Team MITRE 2011-06-01 +00:00 updated Common_Consequences
CWE Content Team MITRE 2011-09-13 +00:00 updated Relationships, Taxonomy_Mappings
CWE Content Team MITRE 2012-05-11 +00:00 updated Common_Consequences, Demonstrative_Examples, References, Relationships
CWE Content Team MITRE 2014-07-30 +00:00 updated Relationships, Taxonomy_Mappings
CWE Content Team MITRE 2017-01-19 +00:00 updated Relationships
CWE Content Team MITRE 2017-11-08 +00:00 updated Causal_Nature, Taxonomy_Mappings
CWE Content Team MITRE 2020-02-24 +00:00 updated Relationships
CWE Content Team MITRE 2021-03-15 +00:00 updated Potential_Mitigations, References
CWE Content Team MITRE 2023-04-27 +00:00 updated Relationships
CWE Content Team MITRE 2023-06-29 +00:00 updated Mapping_Notes
CWE Content Team MITRE 2025-12-11 +00:00 updated Detection_Factors
CWE Content Team MITRE 2026-10-28 +00:00 updated References, Relationships, Taxonomy_Mappings