CWE-839 Detail

CWE-839

Numeric Range Comparison Without Minimum Check
Incomplete
2011-03-30
00h00 +00:00
2025-12-11
00h00 +00:00
Meldingen voor een CWE
Blijf op de hoogte van wijzigingen voor een specifieke CWE.
Meldingen beheren

Naam: Numeric Range Comparison Without Minimum Check

The product checks a value to ensure that it is less than or equal to a maximum, but it does not also verify that the value is greater than or equal to the minimum.

Algemene informatie

Introductiemodi

Implementation

Toepasselijke platforms

Taal

Name: C (Often)
Name: C++ (Often)

Veelvoorkomende gevolgen

Bereik Impact Waarschijnlijkheid
Integrity
Confidentiality
Availability
Modify Application Data, Execute Unauthorized Code or Commands

Note: An attacker could modify the structure of the message or data being sent to the downstream component, possibly injecting commands.
AvailabilityDoS: Resource Consumption (Other)

Note: in some contexts, a negative value could lead to resource consumption.
Confidentiality
Integrity
Modify Memory, Read Memory

Note: If a negative value is used to access memory, buffers, or other indexable structures, it could access memory outside the bounds of the buffer.

Waargenomen voorbeelden

Referenties Beschrijving

CVE-2010-1866

Chain: integer overflow (CWE-190) causes a negative signed value, which later bypasses a maximum-only check (CWE-839), leading to heap-based buffer overflow (CWE-122).

CVE-2009-1099

Chain: 16-bit counter can be interpreted as a negative value, compared to a 32-bit maximum value, leading to buffer under-write.

CVE-2011-0521

Chain: kernel's lack of a check for a negative value leads to memory corruption.

CVE-2010-3704

Chain: parser uses atoi() but does not check for a negative value, which can happen on some platforms, leading to buffer under-write.

CVE-2010-2530

Chain: Negative value stored in an int bypasses a size check and causes allocation of large amounts of memory.

CVE-2009-3080

Chain: negative offset value to IOCTL bypasses check for maximum index, then used as an array index for buffer under-read.

CVE-2008-6393

chain: file transfer client performs signed comparison, leading to integer overflow and heap-based buffer overflow.

CVE-2008-4558

chain: negative ID in media player bypasses check for maximum index, then used as an array index for buffer under-read.

Mogelijke risicobeperkingen

Phases : Implementation
If the number to be used is always expected to be positive, change the variable type from signed to unsigned or size_t.
Phases : Implementation
If the number to be used could have a negative value based on the specification (thus requiring a signed value), but the number should only be positive to preserve code correctness, then include a check to ensure that the value is positive.

Detectiemethoden

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.)

Notities kwetsbaarheidsmapping

Rechtvaardiging : 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.
Opmerking : 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.

Referenties

REF-62

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

REF-62

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

Indiening

Naam Organisatie Datum Releasedatum Version
CWE Content Team MITRE 2011-03-24 +00:00 2011-03-30 +00:00 1.12

Wijzigingen

Naam Organisatie Datum Opmerking
CWE Content Team MITRE 2011-06-01 +00:00 updated Common_Consequences
CWE Content Team MITRE 2012-05-11 +00:00 updated Demonstrative_Examples, References, Relationships
CWE Content Team MITRE 2014-02-18 +00:00 updated Relationships
CWE Content Team MITRE 2018-03-27 +00:00 updated Description
CWE Content Team MITRE 2019-01-03 +00:00 updated Relationships
CWE Content Team MITRE 2023-01-31 +00:00 updated Alternate_Terms, Description
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 2023-10-26 +00:00 updated Observed_Examples
CWE Content Team MITRE 2025-09-09 +00:00 updated Demonstrative_Examples
CWE Content Team MITRE 2025-12-11 +00:00 updated Detection_Factors, Time_of_Introduction, Weakness_Ordinalities