CVE-2021-29611: TensorFlow: DoS via SparseReshape invalid tensor input

MEDIUM PoC AVAILABLE
Published May 14, 2021
CISO Take

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.

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
195.0K OpenSSF 7.2 3.7K dependents Pushed today 4% patched ~1372d to patch Full package profile →

Do you use tensorflow? You're affected.

Severity & Risk

CVSS 3.1
5.5 / 10
EPSS
0.0%
chance of exploitation in 30 days
Higher than 1% of all CVEs
Exploitation Status
Exploit Available
Exploitation: MEDIUM
Sophistication
Trivial
Exploitation Confidence
medium
Public PoC indexed (trickest/cve)
Composite signal derived from CISA KEV, CISA SSVC, EPSS, trickest/cve, and Nuclei templates.

Attack Surface

AV AC PR UI S C I A
AV Local
AC Low
PR Low
UI None
S Unchanged
C None
I None
A High

Recommended Action

4 steps
  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.

Classification

Compliance Impact

This CVE is relevant to:

EU AI Act
Article 9 - Risk management system
ISO 42001
8.4 - AI system operation and monitoring
NIST AI RMF
MANAGE 2.2 - Mechanisms to sustain AI system availability and reliability
OWASP LLM Top 10
LLM04 - Model Denial of Service

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.

CVSS Vector

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

Timeline

Published
May 14, 2021
Last Modified
November 21, 2024
First Seen
May 14, 2021

Related Vulnerabilities