CWEweakness
CWE-128 Wrap-around Error
Medium
Official page ↗
- Abstraction
- Base
- Structure
- Simple
- Status
- Incomplete
- Likelihood of exploit
- Medium
- Languages
- C, C++
- CWE version
- 5.0
Description
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.
Common consequences
• 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.
Potential mitigations
• 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.
Detection methods
• 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.)
Related
Attack pattern · CAPEC (1)
- CAPEC-92 Forced Integer Overflow attack pattern
Can precede · CWE (1)
- CWE-119 Improper Restriction of Operations within the Bounds of a Memory Buffer weakness
Child of · CWE (1)
- CWE-682 Incorrect Calculation weakness
Peer of · CWE (1)
- CWE-190 Integer Overflow or Wraparound weakness
Referenced by CAPEC · weakness (1)
- CAPEC-92 Forced Integer Overflow attack pattern
Referenced by CVE · weakness (5)
- CVE-2026-20179 Multiple Cisco products are affected by a vulnerability in the Snort 3 Generic Routing Encapsulation (GRE) Detection Engine that could… vulnerability
- CVE-2026-16909 IBM AIX 7.2, and 7.3 and IBM PowerVM VIOS 4.1 could allow a remote attacker to execute arbitrary code due to an off-by-one error in bounds… vulnerability
- CVE-2026-54905 concurrent-ruby is a modern concurrency tools for Ruby. vulnerability
- CVE-2024-23981 Wrap-around error in Linux kernel mode driver for some Intel(R) Ethernet Network Controllers and Adapters before version 28.3 may allow an… vulnerability
- CVE-2022-35258 An unauthenticated attacker can cause a denial-of-service to the following products: Ivanti Connect Secure (ICS) in versions prior to… vulnerability
Referenced by CWE · has member (1)
- CWE-1460 Weaknesses Addressed by the Top 20 Secure PLC Coding Practices view