CVE-2021-24028
Description
An invalid free in Thrift's table-based serialization can cause the application to crash or potentially result in code execution or other undesirable effects. This issue affects Facebook Thrift prior to v2021.02.22.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 check for an already-active union member before placement-new re-initialization causes an invalid free in Thrift's table-based serializer"
Attack vector
An attacker can craft a malicious Thrift payload containing invalid union data where the active member ID is non-zero but the union already holds a live object. When the table-based serializer deserializes this payload, the old `read()` path would placement-new over the existing object without first clearing it, causing an invalid free [ref_id=1]. This can lead to application crash or potentially arbitrary code execution. The attack is network-triggered by sending a specially crafted Thrift message to a service using the affected serialization path.
Affected code
The vulnerability is in the table-based serialization logic for Thrift unions, specifically in `read()` and `write()` functions within the serializer. The patch modifies `activeUnionMemberId` (renamed to `getActiveId`) and the `read()` function to check whether the active union member ID is non-zero before re-initializing a member, preventing an invalid free when deserializing malformed union data [ref_id=1].
What the fix does
The patch adds a check `if (activeId != 0)` before re-initializing a union member in the `read()` function, and calls `structInfo.unionExt->clear(object)` to properly destroy the existing active member before placement-new of the new member [ref_id=1]. This prevents the invalid free that occurred when the serializer overwrote a live union member without first cleaning it up. The `write()` path is also updated to use the renamed `getActiveId` helper for consistency.
Preconditions
- configThe service must use Facebook Thrift's table-based serialization for union types
- networkThe attacker must be able to send a crafted Thrift message over the network
- inputThe crafted payload must contain invalid union data where the active member ID is non-zero but the union already holds a live object
Generated on May 29, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
2- github.com/facebook/fbthrift/commit/bfda1efa547dce11a38592820916db01b05b9339mitrex_refsource_CONFIRM
- www.facebook.com/security/advisories/cve-2021-24028mitrex_refsource_CONFIRM
News mentions
0No linked articles in our index yet.