CVE-2021-29519: TensorFlow SparseCross: type confusion DoS
MEDIUM PoC AVAILABLEA type confusion bug in TensorFlow's SparseCross op lets any local low-privilege user crash TF-based workloads via a CHECK-failure abort — no data exposure, availability impact only. Patch to TF 2.5.0+ or apply the backports (2.4.2, 2.3.3, 2.2.3, 2.1.4). Priority is moderate unless you run shared ML infrastructure where untrusted users can submit training jobs or model inputs.
What is the risk?
Medium risk in practice. Local attack vector with low-privilege requirement significantly limits exposure — a remote attacker needs a foothold first, or the vulnerable op must be reachable via a model serving endpoint processing user-supplied sparse features. No confidentiality or integrity impact (C:N/I:N/A:H). Not in CISA KEV, no evidence of active exploitation. Risk elevates meaningfully in shared GPU clusters, multi-tenant Jupyter/MLflow environments, or online feature preprocessing services that invoke SparseCross on user-controlled categorical inputs.
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| TensorFlow | pip | — | No patch |
Do you use TensorFlow? You're affected.
How severe is it?
What is the attack surface?
What should I do?
5 steps-
PATCH
Upgrade to TF 2.5.0+. Backports available for TF 2.4.2, 2.3.3, 2.2.3, 2.1.4 — apply the minimum backport matching your installed branch. Commit: b1cc5e5a50e7cee09f2c6eb48eb40ee9c4125025.
-
INPUT VALIDATION
Add explicit dtype guards before SparseCross calls — reject inputs that mix DT_STRING and DT_INT64 types at the application layer.
-
ISOLATION
Ensure TF Serving instances handling external inputs run in sandboxed containers with restart policies; limit blast radius of process crashes.
-
DETECTION
Alert on repeated TF process SIGABRT/CHECK failure signals (look for 'Check failed' in TF logs); anomalous crash patterns from the same user or endpoint warrant investigation.
-
INVENTORY
Audit all TF versions across ML training, serving, and preprocessing workloads — unpatched versions in containerized ML pipelines are the highest-priority targets.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-29519?
A type confusion bug in TensorFlow's SparseCross op lets any local low-privilege user crash TF-based workloads via a CHECK-failure abort — no data exposure, availability impact only. Patch to TF 2.5.0+ or apply the backports (2.4.2, 2.3.3, 2.2.3, 2.1.4). Priority is moderate unless you run shared ML infrastructure where untrusted users can submit training jobs or model inputs.
Is CVE-2021-29519 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-29519, increasing the risk of exploitation.
How to fix CVE-2021-29519?
1. PATCH: Upgrade to TF 2.5.0+. Backports available for TF 2.4.2, 2.3.3, 2.2.3, 2.1.4 — apply the minimum backport matching your installed branch. Commit: b1cc5e5a50e7cee09f2c6eb48eb40ee9c4125025. 2. INPUT VALIDATION: Add explicit dtype guards before SparseCross calls — reject inputs that mix DT_STRING and DT_INT64 types at the application layer. 3. ISOLATION: Ensure TF Serving instances handling external inputs run in sandboxed containers with restart policies; limit blast radius of process crashes. 4. DETECTION: Alert on repeated TF process SIGABRT/CHECK failure signals (look for 'Check failed' in TF logs); anomalous crash patterns from the same user or endpoint warrant investigation. 5. INVENTORY: Audit all TF versions across ML training, serving, and preprocessing workloads — unpatched versions in containerized ML pipelines are the highest-priority targets.
What systems are affected by CVE-2021-29519?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, feature engineering pipelines.
What is the CVSS score for CVE-2021-29519?
CVE-2021-29519 has a CVSS v3.1 base score of 5.5 (MEDIUM). The EPSS exploitation probability is 0.19%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0029 Denial of AI Service AML.T0043.003 Manual Modification Compliance Controls Affected
What are the technical details?
Original Advisory
TensorFlow is an end-to-end open source platform for machine learning. The API of `tf.raw_ops.SparseCross` allows combinations which would result in a `CHECK`-failure and denial of service. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/3d782b7d47b1bf2ed32bd4a246d6d6cadc4c903d/tensorflow/core/kernels/sparse_cross_op.cc#L114-L116) is tricked to consider a tensor of type `tstring` which in fact contains integral elements. Fixing the type confusion by preventing mixing `DT_STRING` and `DT_INT64` types solves this issue. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
Exploitation Scenario
An adversary with access to a shared MLOps environment — a data scientist account on a multi-tenant JupyterHub, an MLflow experiment runner, or a compromised CI/CD pipeline — writes a short Python snippet invoking tf.raw_ops.SparseCross and passes it a tstring-typed tensor populated with integer values. When the op executes, TF's internal CHECK fires and aborts the process. In a co-located GPU cluster, this terminates other users' training runs. A more impactful scenario: an online serving endpoint preprocessing user-supplied sparse categorical features (e.g., for a recommendation model) uses SparseCross in the feature pipeline. An external attacker crafts HTTP requests with malformed feature payloads containing mixed-type tensors, repeatedly crashing the serving process and causing sustained service unavailability for all users of that model.
Weaknesses (CWE)
CWE-843 — Access of Resource Using Incompatible Type ('Type Confusion'): The product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H References
- github.com/tensorflow/tensorflow/commit/b1cc5e5a50e7cee09f2c6eb48eb40ee9c4125025 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-772j-h9xw-ffp5 Exploit Patch 3rd Party
Timeline
Related Vulnerabilities
CVE-2020-15196 9.9 TensorFlow: heap OOB read in sparse/ragged count ops
Same package: tensorflow CVE-2020-15205 9.8 TensorFlow: heap overflow in StringNGrams, ASLR bypass
Same package: tensorflow CVE-2020-15208 9.8 TFLite: OOB read/write via tensor dimension mismatch
Same package: tensorflow CVE-2019-16778 9.8 TensorFlow: heap overflow in UnsortedSegmentSum op
Same package: tensorflow CVE-2022-23587 9.8 TensorFlow: integer overflow in Grappler enables RCE
Same package: tensorflow