CVE-2019-11938
Description
Java Facebook Thrift servers would not error upon receiving messages declaring containers of sizes larger than the payload. As a result, malicious clients could send short messages which would result in a large memory allocation, potentially leading to denial of service. This issue affects Facebook Thrift prior to v2019.12.09.00.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected products
24- osv-coords22 versionspkg:apk/chainguard/libthriftpkg:apk/chainguard/libthrift-glibpkg:apk/chainguard/libthriftnbpkg:apk/chainguard/libthriftzpkg:apk/chainguard/py3.10-thriftpkg:apk/chainguard/py3.11-thriftpkg:apk/chainguard/py3.12-thriftpkg:apk/chainguard/py3.13-thriftpkg:apk/chainguard/py3-supported-thriftpkg:apk/chainguard/thriftpkg:apk/chainguard/thrift-devpkg:apk/wolfi/libthriftpkg:apk/wolfi/libthrift-glibpkg:apk/wolfi/libthriftnbpkg:apk/wolfi/libthriftzpkg:apk/wolfi/py3.10-thriftpkg:apk/wolfi/py3.11-thriftpkg:apk/wolfi/py3.12-thriftpkg:apk/wolfi/py3.13-thriftpkg:apk/wolfi/py3-supported-thriftpkg:apk/wolfi/thriftpkg:apk/wolfi/thrift-dev
< 0+ 21 more
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
Patches
Vulnerability mechanics
Root cause
"Missing validation of container size against remaining frame data before memory allocation in Java Thrift protocol deserialization."
Attack vector
An unauthenticated attacker sends a crafted Thrift message over the network declaring a container (list, set, or map) with an extremely large size but providing only a small payload. The server reads the size field and immediately allocates memory proportional to that declared size without verifying that the remaining frame bytes can actually contain that many elements. This causes a large memory allocation from a short message, leading to denial of service via memory exhaustion. The attack requires no authentication and can be performed over any network path reachable to the Thrift server. [CWE-789] [ref_id=1]
Affected code
The vulnerability exists in the Java Thrift protocol deserialization code, specifically in `TBinaryProtocol.java` and `TCompactProtocol.java` within the `readMapBegin()`, `readListBegin()`, and `readSetBegin()` methods. These methods read container size fields from the wire without validating that the remaining frame data is sufficient to hold the declared number of elements. The fix introduces `ensureContainerHasEnough()` and `ensureMapHasEnough()` checks in the base `TProtocol.java` class, along with `typeMinimumSize()` overrides for each protocol variant.
What the fix does
The patch adds `ensureContainerHasEnough(size, type)` and `ensureMapHasEnough(size, keyType, valueType)` methods to the base `TProtocol` class. These methods compute the minimum number of remaining bytes required to deserialize the declared container elements (using `typeMinimumSize()` to get the smallest possible encoding size per element) and compare that against `trans_.getBytesRemainingInBuffer()`. If the remaining bytes are insufficient, a `TProtocolException` is thrown instead of proceeding with the oversized allocation. Each protocol subclass overrides `typeMinimumSize()` to return the correct minimum byte size for its encoding format (e.g., 1 byte for variable-length integers in compact protocol). This prevents the server from allocating memory for containers whose declared size exceeds the actual available data. [ref_id=1] [ref_id=2]
Preconditions
- networkThe attacker must be able to send a crafted Thrift message to a Java Thrift server.
- authNo authentication is required; the vulnerability is triggered during initial deserialization of the message frame.
Generated on Jun 1, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
3- github.com/facebook/fbthrift/commit/08c2d412adb214c40bb03be7587057b25d053030mitrex_refsource_MISC
- github.com/facebook/fbthrift/commit/71c97ffdcb61cccf1f8267774e873e21ebd3ebd3mitrex_refsource_MISC
- www.facebook.com/security/advisories/cve-2019-11938mitrex_refsource_CONFIRM
News mentions
0No linked articles in our index yet.