CVE-2019-3553
Description
C++ 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 v2020.02.03.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 bounds check before memory allocation: the server trusts the declared size of containers and strings without verifying that the remaining payload is sufficient to hold the declared number of elements."
Attack vector
A malicious client sends a Thrift message that declares a container (list, set, map) or string with a size field that is much larger than the actual payload bytes that follow. The server trusts the declared size and attempts to allocate memory for the full container before reading the elements. Because the declared size can be arbitrarily large while the actual message is short, the server may allocate an enormous buffer, leading to memory exhaustion and denial of service. No authentication is required; the attacker only needs network access to a vulnerable Thrift endpoint.
Affected code
The vulnerability exists in the container-reading logic of Facebook Thrift's protocol layer. The patch adds `canReadNElements()` checks in `protocol_methods` for `list`, `set`, and `map` types (ref_id=1), and adds `in_.canAdvance(size)` checks in `BinaryProtocolReader::readStringBody` and `CompactProtocolReader::readStringBody` for string fields (ref_id=2). A new `throwTruncatedData()` static method on `TProtocolException` is introduced to signal the error.
What the fix does
The fix adds a lightweight lower-bound check — `canReadNElements()` — before reading list, set, and map elements (ref_id=1). This function verifies that the remaining buffer contains at least `n * sizeof(element_type)` bytes. If the check fails, `throwTruncatedData()` is called, which raises a `TProtocolException` with the message "Not enough bytes to read the entire message, the data appears to be truncated". Similarly, string readers in both `BinaryProtocolReader` and `CompactProtocolReader` now call `in_.canAdvance(size)` before reserving memory (ref_id=2). These checks prevent the server from committing to a large allocation when the payload is demonstrably too short.
Preconditions
- networkNetwork access to a vulnerable Facebook Thrift server (prior to v2020.02.03.00)
- inputAbility to send a crafted Thrift message with a container or string size field larger than the actual payload
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/3f156207e8a6583d88999487e954320dc18955e6mitrex_refsource_MISC
- github.com/facebook/fbthrift/commit/c9a903e5902834e95bbd4ab0e9fa53ba0189f351mitrex_refsource_MISC
- www.facebook.com/security/advisories/cve-2019-3553mitrex_refsource_CONFIRM
News mentions
0No linked articles in our index yet.