CVE-2021-29560: TensorFlow: heap OOB in RaggedTensorToTensor op

HIGH PoC AVAILABLE
Published May 14, 2021
CISO Take

A heap buffer overflow in TensorFlow's RaggedTensorToTensor operation allows a low-privileged local attacker to read arbitrary memory or crash the TF process. Risk is highest in shared ML platforms, JupyterHub environments, and MLaaS deployments where users can submit arbitrary tensor shapes. Patch to TensorFlow 2.5.0 or the corresponding backport (2.4.2, 2.3.3, 2.2.3, 2.1.4) and audit any service accepting user-controlled RaggedTensor inputs.

Risk Assessment

CVSS 7.1 High with local attack vector. The local prerequisite limits internet-scale exposure, but shared ML infrastructure—JupyterHub clusters, multi-tenant GPU farms, Kubeflow pipelines—creates realistic low-privilege attack paths. Dual CWE-125/CWE-787 profile (OOB read + write) enables both memory disclosure and potential code execution. Not in CISA KEV and no known active exploitation, but the low attack complexity means exploitation is straightforward for anyone with local TF access on an unpatched system.

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.1 / 10
EPSS
0.0%
chance of exploitation in 30 days
Higher than 2% 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 None
A High

Recommended Action

5 steps
  1. Upgrade TensorFlow to 2.5.0, or apply backports: 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4.

  2. Block or sanitize user-controlled tensor shape inputs before they reach tf.raw_ops.RaggedTensorToTensor—validate that parent_output_index length >= row_split length.

  3. In shared platforms (JupyterHub, SageMaker Studio), restrict access to tf.raw_ops namespace for untrusted users.

  4. Enable process-level sandboxing and resource limits for TF inference workers.

  5. Monitor for anomalous process crashes or unexpected OOM events in TF serving pods as an exploitation indicator.

Classification

Compliance Impact

This CVE is relevant to:

EU AI Act
Art.9 - Risk Management System
ISO 42001
A.6.1.4 - AI system lifecycle — third-party components
NIST AI RMF
MANAGE-2.2 - Treatment of identified AI risks
OWASP LLM Top 10
LLM06:2025 - Excessive Agency / Supply Chain

Frequently Asked Questions

What is CVE-2021-29560?

A heap buffer overflow in TensorFlow's RaggedTensorToTensor operation allows a low-privileged local attacker to read arbitrary memory or crash the TF process. Risk is highest in shared ML platforms, JupyterHub environments, and MLaaS deployments where users can submit arbitrary tensor shapes. Patch to TensorFlow 2.5.0 or the corresponding backport (2.4.2, 2.3.3, 2.2.3, 2.1.4) and audit any service accepting user-controlled RaggedTensor inputs.

Is CVE-2021-29560 actively exploited?

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

How to fix CVE-2021-29560?

1. Upgrade TensorFlow to 2.5.0, or apply backports: 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4. 2. Block or sanitize user-controlled tensor shape inputs before they reach tf.raw_ops.RaggedTensorToTensor—validate that parent_output_index length >= row_split length. 3. In shared platforms (JupyterHub, SageMaker Studio), restrict access to tf.raw_ops namespace for untrusted users. 4. Enable process-level sandboxing and resource limits for TF inference workers. 5. Monitor for anomalous process crashes or unexpected OOM events in TF serving pods as an exploitation indicator.

What systems are affected by CVE-2021-29560?

This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, data preprocessing pipelines, shared ML platforms.

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

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

Technical Details

NVD Description

TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a heap buffer overflow in `tf.raw_ops.RaggedTensorToTensor`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/d94227d43aa125ad8b54115c03cece54f6a1977b/tensorflow/core/kernels/ragged_tensor_to_tensor_op.cc#L219-L222) uses the same index to access two arrays in parallel. Since the user controls the shape of the input arguments, an attacker could trigger a heap OOB access when `parent_output_index` is shorter than `row_split`. 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 training cluster (e.g., a compromised data scientist account or malicious insider) crafts a TensorFlow script that calls tf.raw_ops.RaggedTensorToTensor with a row_split tensor longer than parent_output_index. The kernel iterates using the same index across both arrays, reading and writing beyond the allocated heap buffer. In a benign scenario this crashes the worker process. With heap feng shui—allocating controlled objects adjacent to the target buffer—the attacker can overwrite heap metadata or function pointers to achieve code execution within the TF process, potentially pivoting to the underlying host in containerized ML serving environments.

CVSS Vector

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

Timeline

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

Related Vulnerabilities