CWE-839: Numeric Range Comparison Without Minimum Check
8 CVEs have CWE-839 as their primary weakness. 0 of them are in the CISA KEV catalog. The highest EPSS score among them is 1.676%.
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.
Child of CWE-1023: Incomplete Comparison with Missing Factors
Mitigations
- Implementation: If the number to be used is always expected to be positive, change the variable type from signed to unsigned or size_t.
- 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.
Observed examples
- 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.
Get more CVE data from the API.
curl 'https://api.contrastcyber.com/cwe_lookup/CWE-839'curl 'https://api.contrastcyber.com/cve_search?cwe_id=CWE-839'
Sources
- Vulnerability data from the National Vulnerability Database (NIST) and the CVE Program. CVE records: Copyright © 1999-2026, The MITRE Corporation, used under the CVE Program Terms of Use. CVE® is a registered trademark of The MITRE Corporation.
- CWE definitions: Copyright © 2006-2026, The MITRE Corporation, used under the CWE Terms of Use. CWE is a trademark of The MITRE Corporation.
- EPSS scores by FIRST.org EPSS, used with attribution.
- KEV catalog and SSVC decisions by CISA.
- Advisory data from the GitHub Advisory Database through OSV.dev (CC BY 4.0).
- Exploit metadata from the Exploit Database (GPL-2.0-only, metadata only).
- Nuclei template names from nuclei-templates (MIT).