CVE-2021-29616: TensorFlow: null ptr deref in graph optimizer

HIGH PoC AVAILABLE
Published May 14, 2021
CISO Take

Upgrade TensorFlow to 2.5.0 or the patched backports (2.4.2, 2.3.3, 2.2.3, 2.1.4) immediately. This null pointer dereference in the arithmetic optimizer crashes training jobs and is exploitable for code execution in shared ML compute environments. Shared Jupyter servers, Kubeflow pipelines, and multi-tenant ML platforms are the primary risk surface.

Risk Assessment

CVSS 7.8 High with local attack vector and low privilege requirement. While not remotely exploitable by default, shared ML training environments — cloud notebooks, ML platforms, containerized training clusters — are meaningfully exposed to malicious insiders or compromised accounts. Low complexity means exploitation is reliable once local access exists. The Grappler arithmetic optimizer runs on all TensorFlow graph compilations, broadening the trigger surface beyond isolated scenarios.

Affected Systems

Package Ecosystem Vulnerable Range Patched
tensorflow pip No patch
195.0K OpenSSF 7.2 3.7K dependents Pushed 6d ago 4% patched ~1372d to patch Full package profile →

Do you use tensorflow? You're affected.

Severity & Risk

CVSS 3.1
7.8 / 10
EPSS
0.0%
chance of exploitation in 30 days
Higher than 1% of all CVEs
Exploitation Status
Exploit Available
Exploitation: MEDIUM
Sophistication
Moderate
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 High
I High
A High

Recommended Action

5 steps
  1. Patch: Upgrade to TensorFlow 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4.

  2. Workaround (if immediate upgrade is blocked): disable the arithmetic optimizer via tf.config.optimizer.set_experimental_options({'arithmetic_optimization': False}).

  3. Isolate: Run TensorFlow jobs in isolated containers or VMs to contain blast radius if triggered.

  4. Detect: Monitor for unexpected TensorFlow process crashes or segfaults during graph compilation phases.

  5. Inventory: Enumerate all TensorFlow versions across environments using SBOM tooling — this library appears in many transitive dependencies.

Classification

Compliance Impact

This CVE is relevant to:

EU AI Act
Art. 15 - Accuracy, robustness and cybersecurity
ISO 42001
A.6.2.6 - AI system security and resilience
NIST AI RMF
MANAGE 2.2 - Mechanisms are in place to address AI risks
OWASP LLM Top 10
LLM05:2025 - Supply Chain Vulnerabilities

Frequently Asked Questions

What is CVE-2021-29616?

Upgrade TensorFlow to 2.5.0 or the patched backports (2.4.2, 2.3.3, 2.2.3, 2.1.4) immediately. This null pointer dereference in the arithmetic optimizer crashes training jobs and is exploitable for code execution in shared ML compute environments. Shared Jupyter servers, Kubeflow pipelines, and multi-tenant ML platforms are the primary risk surface.

Is CVE-2021-29616 actively exploited?

Proof-of-concept exploit code is publicly available for CVE-2021-29616, increasing the risk of exploitation.

How to fix CVE-2021-29616?

1. Patch: Upgrade to TensorFlow 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4. 2. Workaround (if immediate upgrade is blocked): disable the arithmetic optimizer via tf.config.optimizer.set_experimental_options({'arithmetic_optimization': False}). 3. Isolate: Run TensorFlow jobs in isolated containers or VMs to contain blast radius if triggered. 4. Detect: Monitor for unexpected TensorFlow process crashes or segfaults during graph compilation phases. 5. Inventory: Enumerate all TensorFlow versions across environments using SBOM tooling — this library appears in many transitive dependencies.

What systems are affected by CVE-2021-29616?

This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, ML platform infrastructure, Jupyter/notebook environments.

What is the CVSS score for CVE-2021-29616?

CVE-2021-29616 has a CVSS v3.1 base score of 7.8 (HIGH). The EPSS exploitation probability is 0.01%.

Technical Details

NVD Description

TensorFlow is an end-to-end open source platform for machine learning. The implementation of TrySimplify(https://github.com/tensorflow/tensorflow/blob/c22d88d6ff33031aa113e48aa3fc9aa74ed79595/tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc#L390-L401) has undefined behavior due to dereferencing a null pointer in corner cases that result in optimizing a node with no inputs. 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 ML platform (Jupyter notebook server, Kubeflow, SageMaker multi-user studio) crafts a TensorFlow computational graph containing nodes with zero inputs and submits it for execution. When Grappler's TrySimplify processes the graph, it dereferences a null pointer, triggering a segfault. In environments where TensorFlow runs with elevated privileges — common in training clusters requiring GPU/hardware access — this crash can be leveraged for code execution via memory exploitation techniques or weaponized for targeted denial-of-service against competing training workloads in shared infrastructure.

CVSS Vector

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

Timeline

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

Related Vulnerabilities