CVE-2021-29611: TensorFlow: DoS via SparseReshape invalid tensor input
MEDIUM PoC AVAILABLEThis medium-severity local DoS in TensorFlow's SparseReshape op allows any user with local execution access to crash the TensorFlow process by supplying a malformed sparse tensor. For ML platforms where users submit training jobs or inference requests (shared compute, Jupyter, Vertex AI, SageMaker), this is a reliable availability disruption vector. Upgrade affected deployments to TensorFlow 2.5.0, 2.4.2, or 2.3.3 immediately.
Risk Assessment
Risk is moderate-to-low in isolated environments but elevates in multi-tenant ML platforms. The local attack vector (AV:L) limits remote exploitability, but in practice most ML training infrastructure exposes code execution via notebooks, job schedulers, or REST APIs that accept user-defined graphs—effectively lowering the bar to exploitation. No confidentiality or integrity impact; purely an availability issue. Not in CISA KEV and no active exploitation reported. CVSS 5.5 accurately reflects the limited blast radius in properly segmented deployments.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| tensorflow | pip | — | No patch |
Do you use tensorflow? You're affected.
Severity & Risk
Attack Surface
Recommended Action
4 steps-
Patch: Upgrade to TensorFlow 2.5.0, 2.4.2, or 2.3.3. Verify via
pip show tensorflow. -
Workaround: Validate sparse tensor dimensions and non-zero counts at API/pipeline ingestion boundaries before passing to SparseReshape—reject inputs where shape product does not match nnz.
-
Isolation: Run TensorFlow model servers in separate processes per tenant; use process-level isolation (containers) so a crash does not affect other users.
-
Detection: Monitor for abnormal TF process exits (SIGABRT) and CHECK-failure log messages containing 'SparseReshape'. Alert on unexpected serving process restarts.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-29611?
This medium-severity local DoS in TensorFlow's SparseReshape op allows any user with local execution access to crash the TensorFlow process by supplying a malformed sparse tensor. For ML platforms where users submit training jobs or inference requests (shared compute, Jupyter, Vertex AI, SageMaker), this is a reliable availability disruption vector. Upgrade affected deployments to TensorFlow 2.5.0, 2.4.2, or 2.3.3 immediately.
Is CVE-2021-29611 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-29611, increasing the risk of exploitation.
How to fix CVE-2021-29611?
1. Patch: Upgrade to TensorFlow 2.5.0, 2.4.2, or 2.3.3. Verify via `pip show tensorflow`. 2. Workaround: Validate sparse tensor dimensions and non-zero counts at API/pipeline ingestion boundaries before passing to SparseReshape—reject inputs where shape product does not match nnz. 3. Isolation: Run TensorFlow model servers in separate processes per tenant; use process-level isolation (containers) so a crash does not affect other users. 4. Detection: Monitor for abnormal TF process exits (SIGABRT) and CHECK-failure log messages containing 'SparseReshape'. Alert on unexpected serving process restarts.
What systems are affected by CVE-2021-29611?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, ML data preprocessing, shared compute / multi-tenant ML platforms.
What is the CVSS score for CVE-2021-29611?
CVE-2021-29611 has a CVSS v3.1 base score of 5.5 (MEDIUM). The EPSS exploitation probability is 0.01%.
Technical Details
NVD Description
TensorFlow is an end-to-end open source platform for machine learning. Incomplete validation in `SparseReshape` results in a denial of service based on a `CHECK`-failure. The implementation(https://github.com/tensorflow/tensorflow/blob/e87b51ce05c3eb172065a6ea5f48415854223285/tensorflow/core/kernels/sparse_reshape_op.cc#L40) has no validation that the input arguments specify a valid sparse tensor. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2 and TensorFlow 2.3.3, as these are the only affected versions.
Exploitation Scenario
An adversary with access to a shared ML platform (e.g., a data scientist submitting jobs, or an external user querying a TensorFlow Serving endpoint that accepts sparse tensor inputs) crafts a SparseTensor with an inconsistent shape—e.g., declaring a 2D shape [10, 10] but providing indices that exceed those bounds, or mismatching the dense_shape dimensions against actual values. When the model pipeline calls SparseReshape on this input, the incomplete validation triggers a CHECK-failure abort, crashing the TensorFlow process. On a shared training cluster, this kills co-located training jobs. On a serving deployment, it causes a service outage until the process is restarted.
Weaknesses (CWE)
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/1d04d7d93f4ed3854abf75d6b712d72c3f70d6b6 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-9rpc-5v9q-5r7f 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
AI Threat Alert