CWE-191 · Słabość
Integer Underflow (Wrap or Wraparound)
- Abstrakcja
- Bazowa
- Status
- Szkic
- Dodano
- 19 lipca 2006
- Ostatnia zmiana
- 11 grudnia 2025
Opis
The product subtracts one value from another, such that the result is less than the minimum allowable integer value, which produces a value that is not equal to the correct result.
This can happen in signed and unsigned cases.
Inne nazwy
- Integer underflow
- "Integer underflow" is sometimes used to identify signedness errors in which an originally positive number becomes negative as a result of subtraction. However, there are cases of bad subtraction in which unsigned integers are involved, so it's not always a signedness issue. "Integer underflow" is occasionally used to describe array index errors in which the index is negative.
Skutki
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.
Przykłady podatności
- CVE-2004-0816 Integer underflow in firewall via malformed packet.
- CVE-2004-1002 Integer underflow by packet with invalid length.
- CVE-2005-0199 Long input causes incorrect length calculation.
- CVE-2005-1891 Malformed icon causes integer underflow in loop counter variable.
Słabość nadrzędna
Kiedy powstaje
- Implementation
Dotyczy
C, C++, Java, C#
Źródła
- 24 Deadly Sins of Software Security — Michael Howard, David LeBlanc, John Viega, "Sin 7: Integer Overflows." Page 119, McGraw-Hill, 2010
Wpis z katalogu CWE 4.20.