Skip to main content

CWE-128: Wrap-around Error

BaseIncompleteExploit Likelihood: Medium

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.

View on MITRE
Back to CWE Lookup

Technical Details

Structure
Simple

Applicable To

Languages
CC++
Platforms

Frequently Asked Questions

What is CWE-128: Wrap-around Error?+

CWE-128: Wrap-around Error is a Common Weakness Enumeration (CWE) entry maintained by MITRE. 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.

What are the security consequences of Wrap-around Error?+

If exploited, CWE-128 (Wrap-around Error) it can compromise Availability, Integrity, Confidentiality and Access Control, leading to outcomes such as DoS: Crash, Exit, or Restart, DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory), DoS: Instability, Modify Memory and Execute Unauthorized Code or Commands.

How do you prevent or mitigate Wrap-around Error?+

Recommended mitigations for CWE-128 include: Requirements specification: The choice could be made to use a language that is not susceptible to these issues. Provide clear upper and lower bounds on the scale of any protocols designed. Perform validation on all incremented variables to ensure that they remain within reasonable bounds.

Which programming languages are affected by Wrap-around Error?+

CWE-128 commonly affects C and C++. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What is the difference between a CWE and a CVE?+

A CWE (Common Weakness Enumeration) like CWE-128 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.

Learn More