CWE-130: Improper Handling of Length Parameter Inconsistency
The product parses a formatted message or structure, but it does not handle or incorrectly handles a length field that is inconsistent with the actual length of the associated data.
If an attacker can manipulate the length parameter associated with an input such that it is inconsistent with the actual length of the input, this can be leveraged to cause the target application to behave in unexpected, and possibly, malicious ways. One of the possible motives for doing so is to pass in arbitrarily large input to the application. Another possible motivation is the modification of application state by including invalid data for subsequent properties of the application. Such weaknesses commonly lead to attacks such as buffer overflows and execution of arbitrary code.
Consequences
- Confidentiality, Integrity: Read Memory, Modify Memory, Varies by Context
How to prevent it
- Implementation: When processing structured incoming data containing a size field followed by raw data, ensure that you identify and resolve any inconsistencies between the size field and the actual size of the data.
- Implementation: Do not let the user control the size of the buffer.
- Implementation: Validate that the length of the user-supplied data is consistent with the buffer size.
Recent advisories
- GHSA-w26r-rmm8-9c29 — Django has an Improper Handling of Length Parameter Inconsistency
- GHSA-hppc-g8h3-xhp3 — rust-openssl: Unchecked callback length in PSK/cookie trampolines leaks adjacent memory to peer
- GHSA-q2ww-5357-x388 — Rack has Content-Length mismatch in Rack::Files error responses
- CVE-2025-14847 — Zlib compressed protocol header length confusion may allow memory read
- GHSA-r836-hh6v-rg5g — Django vulnerable to denial-of-service attack
- GHSA-795c-9xpc-xw6g — Django vulnerable to a denial-of-service attack
- GHSA-qg2p-9jwr-mmqf — Django vulnerable to Denial of Service
- GHSA-f6f8-9mx6-9mx2 — Django vulnerable to Denial of Service
- GHSA-5v95-j4rr-6f3c — rdiffweb's unlimited username field length can lead to DoS
- GHSA-qrj3-hrgj-fm7r — rdiffweb's unlimited length email field can lead to DoS
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor