CVE-2021-29610: TensorFlow: heap R/W via quantization axis underflow

HIGH PoC AVAILABLE
Published May 14, 2021
CISO Take

A logic flaw in TensorFlow's QuantizeAndDequantizeV2 op allows negative axis values to bypass validation, enabling heap read/write with local low-privilege access. Patch immediately to TF 2.5.0 or the respective backport (2.4.2, 2.3.3, 2.2.3, 2.1.4) for any deployment running quantized models. Risk is bounded by the local attack vector but insider threats and compromised ML environments make this exploitable in real pipelines.

Risk Assessment

Medium-high operational risk for shared ML environments. CVSS 7.8 (High) with local/low-complexity attack vector limits external exposure but lateral movement and insider scenarios remain realistic. Heap underflow yielding full C/I/A impact could enable memory disclosure or code execution within ML serving or training infrastructure. Not in CISA KEV and no evidence of active exploitation in the wild, but unpatched TensorFlow deployments remain a target of opportunity — especially in multi-tenant notebook environments.

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 or apply backports 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4.

  2. Audit all TF deployments for version compliance — prioritize internet-accessible inference endpoints and shared training environments.

  3. Restrict execution of untrusted TF graphs and model files in shared platforms.

  4. Container isolation: run TF workloads in sandboxed containers with minimal privileges to limit heap exploitation blast radius.

  5. If observability exists, flag any QuantizeAndDequantizeV2 calls with axis < -1 in op telemetry.

Classification

Compliance Impact

This CVE is relevant to:

EU AI Act
Article 15 - Accuracy, robustness and cybersecurity
ISO 42001
A.9.3 - Information security of AI systems
NIST AI RMF
MANAGE-2.4 - Residual risks and vulnerabilities are managed
OWASP LLM Top 10
LLM05 - Supply Chain Vulnerabilities

Frequently Asked Questions

What is CVE-2021-29610?

A logic flaw in TensorFlow's QuantizeAndDequantizeV2 op allows negative axis values to bypass validation, enabling heap read/write with local low-privilege access. Patch immediately to TF 2.5.0 or the respective backport (2.4.2, 2.3.3, 2.2.3, 2.1.4) for any deployment running quantized models. Risk is bounded by the local attack vector but insider threats and compromised ML environments make this exploitable in real pipelines.

Is CVE-2021-29610 actively exploited?

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

How to fix CVE-2021-29610?

1. Patch: Upgrade to TensorFlow 2.5.0 or apply backports 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4. 2. Audit all TF deployments for version compliance — prioritize internet-accessible inference endpoints and shared training environments. 3. Restrict execution of untrusted TF graphs and model files in shared platforms. 4. Container isolation: run TF workloads in sandboxed containers with minimal privileges to limit heap exploitation blast radius. 5. If observability exists, flag any QuantizeAndDequantizeV2 calls with axis < -1 in op telemetry.

What systems are affected by CVE-2021-29610?

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

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

CVE-2021-29610 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 validation in `tf.raw_ops.QuantizeAndDequantizeV2` allows invalid values for `axis` argument:. The validation(https://github.com/tensorflow/tensorflow/blob/eccb7ec454e6617738554a255d77f08e60ee0808/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L74-L77) uses `||` to mix two different conditions. If `axis_ < -1` the condition in `OP_REQUIRES` will still be true, but this value of `axis_` results in heap underflow. This allows attackers to read/write to other data on the heap. 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 local access — a compromised data scientist workstation or a shared Jupyter environment — crafts a TensorFlow script invoking QuantizeAndDequantizeV2 with axis=-2 or lower. The OR-logic validation bug (using || instead of &&) allows this to pass the OP_REQUIRES check. TF then performs pointer arithmetic resulting in a heap underflow, granting the attacker a read/write primitive against adjacent heap memory. From there, they can extract sensitive data (credentials, model weights, training PII) or corrupt adjacent heap objects to escalate privileges. In a multi-tenant ML platform, a low-privileged user could target another user's process memory through this primitive.

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