CWE•Base•Incomplete•3 recent CVEs
CWE-839Numeric Range Comparison Without Minimum Check
Description
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.
[object Object]
Common consequences
- Integrity,Confidentiality,Availability→Modify Application Data,Execute Unauthorized Code or CommandsAn attacker could modify the structure of the message or data being sent to the downstream component, possibly injecting commands.
- Availability→DoS: Resource Consumption (Other)in some contexts, a negative value could lead to resource consumption.
- Confidentiality,Integrity→Modify Memory,Read MemoryIf a negative value is used to access memory, buffers, or other indexable structures, it could access memory outside the bounds of the buffer.
Potential mitigations
- ImplementationIf the number to be used is always expected to be positive, change the variable type from signed to unsigned or size_t.
- ImplementationIf 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.