CVE-2021-29513: TensorFlow: type confusion → null ptr deref (CVSS 7.8)

HIGH PoC AVAILABLE
Published May 14, 2021
CISO Take

Any TensorFlow deployment that accepts external tensor inputs is at risk of process crash or potential code execution via type confusion in the Python-to-C++ conversion layer. Patch to TF 2.5.0 (or 2.4.2/2.3.3/2.2.3/2.1.4 for pinned versions) immediately. Multi-tenant ML platforms and model serving APIs with untrusted input are highest priority.

What is the risk?

CVSS 7.8 High with local attack vector and low privilege requirement. The full CIA impact score (C:H/I:H/A:H) suggests exploitation potential beyond simple DoS — type confusion vulnerabilities can enable memory corruption and code execution. Not in CISA KEV with no confirmed active exploitation, but trivial exploitation complexity elevates practical risk in shared ML environments significantly.

What systems are affected?

Package Ecosystem Vulnerable Range Patched
TensorFlow pip No patch
195.8K OpenSSF 7.1 3.7K dependents Pushed 3d ago 4% patched ~1372d to patch Full package profile →

Do you use TensorFlow? You're affected.

How severe is it?

CVSS 3.1
7.8 / 10
EPSS
0.2%
chance of exploitation in 30 days
Higher than 10% 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, VulnCheck KEV, CISA SSVC, EPSS, Metasploit, Exploit-DB, trickest/cve, Nuclei templates, and inthewild.io exploitation reports.

What is the 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

What should I do?

5 steps
  1. Upgrade TensorFlow to 2.5.0, or cherry-picked branches 2.4.2/2.3.3/2.2.3/2.1.4.

  2. Enforce numeric dtype validation before passing tensors to TF operations at all API boundaries.

  3. Run TF inference processes in isolated containers to limit blast radius.

  4. Monitor for unexpected TF process crashes in serving infrastructure.

  5. Audit any externally-accessible TensorFlow Serving endpoints for unauthenticated tensor submission.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Art. 15 - Accuracy, robustness and cybersecurity
ISO 42001
8.4 - AI system risk treatment
NIST AI RMF
MANAGE-2.2 - Mechanisms to maintain AI system operations
OWASP LLM Top 10
LLM05:2025 - Improper Output Handling

Frequently Asked Questions

What is CVE-2021-29513?

Any TensorFlow deployment that accepts external tensor inputs is at risk of process crash or potential code execution via type confusion in the Python-to-C++ conversion layer. Patch to TF 2.5.0 (or 2.4.2/2.3.3/2.2.3/2.1.4 for pinned versions) immediately. Multi-tenant ML platforms and model serving APIs with untrusted input are highest priority.

Is CVE-2021-29513 actively exploited?

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

How to fix CVE-2021-29513?

1. Upgrade TensorFlow to 2.5.0, or cherry-picked branches 2.4.2/2.3.3/2.2.3/2.1.4. 2. Enforce numeric dtype validation before passing tensors to TF operations at all API boundaries. 3. Run TF inference processes in isolated containers to limit blast radius. 4. Monitor for unexpected TF process crashes in serving infrastructure. 5. Audit any externally-accessible TensorFlow Serving endpoints for unauthenticated tensor submission.

What systems are affected by CVE-2021-29513?

This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, inference, multi-tenant ML platforms.

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

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

What is the AI security impact?

Affected AI Architectures

model servingtraining pipelinesinferencemulti-tenant ML platforms

MITRE ATLAS Techniques

AML.T0029 Denial of AI Service
AML.T0043 Craft Adversarial Data
AML.T0049 Exploit Public-Facing Application

Compliance Controls Affected

EU AI Act: Art. 15
ISO 42001: 8.4
NIST AI RMF: MANAGE-2.2
OWASP LLM Top 10: LLM05:2025

What are the technical details?

Original Advisory

TensorFlow is an end-to-end open source platform for machine learning. Calling TF operations with tensors of non-numeric types when the operations expect numeric tensors result in null pointer dereferences. The conversion from Python array to C++ array(https://github.com/tensorflow/tensorflow/blob/ff70c47a396ef1e3cb73c90513da4f5cb71bebba/tensorflow/python/lib/core/ndarray_tensor.cc#L113-L169) is vulnerable to a type confusion. 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 attacker with low-privilege access to a shared ML platform (Jupyter user, API client) submits a tensor with string or boolean dtype to a TF operation expecting float/int. The ndarray_tensor.cc Python-to-C++ conversion path dereferences a null pointer, crashing the TF process. In a worst-case memory corruption scenario, controlled exploitation achieves code execution within the ML serving process, enabling pivot to model weights, training data, or adjacent services on the host.

Weaknesses (CWE)

CWE-476 — NULL Pointer Dereference: The product dereferences a pointer that it expects to be valid but is NULL.

  • [Implementation] For any pointers that could have been modified or provided from a function that can return NULL, check the pointer for NULL before use. When working with a multithreaded or otherwise asynchronous environment, ensure that proper locking APIs are used to lock before the check, and unlock when it has finished [REF-1484].
  • [Requirements] Select a programming language that is not susceptible to these issues.

Source: MITRE CWE corpus.

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