CWE-128: Wrap-around Error

Base Incomplete Simple

CWE版本: 4.18

更新日期: 2025-09-09

弱点描述

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.

常见后果

影响范围: Availability

技术影响: DoS: 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.

影响范围: Integrity

技术影响: Modify 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.

阶段: Architecture and Design

描述: Provide clear upper and lower bounds on the scale of any protocols designed.

阶段: Implementation

描述: Perform validation on all incremented variables to ensure that they remain within reasonable bounds.

引入模式

阶段 说明
Implementation -

适用平台

编程语言
C (Often) C++ (Often)

分类映射

分类名称 条目ID 条目名称 映射适配度
CLASP - Wrap-around error -
CERT C Secure Coding MEM07-C Ensure that the arguments to calloc(), when multiplied, can be represented as a size_t -
Software Fault Patterns SFP1 Glitch in computation -
关键信息

CWE ID: CWE-128

抽象级别: Base

结构: Simple

状态: Incomplete

利用可能性: Medium

相关弱点
相关攻击模式
CAPEC-92