CVE-2021-29537: TensorFlow: heap overflow in QuantizedResizeBilinear op

HIGH PoC AVAILABLE
Published May 14, 2021
CISO Take

Any TensorFlow deployment running quantized image processing ops on versions prior to 2.5.0 (or the backport releases) is at risk of heap buffer overflow, potentially leading to code execution within the TF process. Patch immediately to TF 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4 depending on your pinned version. While the local attack vector limits remote exposure, shared ML infrastructure (Jupyter clusters, multi-tenant GPU nodes, model serving APIs) significantly elevates practical risk.

What is the risk?

CVSS 7.8 High with local attack vector, low complexity, and low privileges required. In isolated single-user environments risk is moderate, but most enterprise ML infrastructure is multi-tenant: shared Jupyter notebooks, Kubeflow pipelines, and TF Serving deployments expose this to a wider attacker surface. Any authenticated user on a shared ML platform who can submit TF graph operations can trigger this. No active exploitation or KEV listing, but the exploit primitive (heap overflow with controlled data) is attractive for privilege escalation in multi-user GPU clusters.

What systems are affected?

Package Ecosystem Vulnerable Range Patched
TensorFlow pip No patch
195.8K OpenSSF 7.1 3.7K dependents Pushed 4d 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 11% 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, 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?

1 step
  1. 1) Patch: upgrade to TF 2.5.0 or apply backports to 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4. Verify with pip show tensorflow. 2) Validate quantization thresholds (min/max scalars) before passing to QuantizedResizeBilinear — both must be scalar tensors with finite float values. 3) In TF Serving deployments, enforce input shape and dtype validation at the serving layer to reject malformed quantization parameters before they reach the kernel. 4) Audit multi-tenant Jupyter/Kubeflow environments for unpinned TF versions. 5) Detection: monitor for SIGSEGV/heap corruption signals in TF worker processes, unusual coredumps from model serving pods.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Article 15 - Accuracy, robustness and cybersecurity
ISO 42001
A.6.2.3 - AI system security
NIST AI RMF
GOVERN-1.1 - Policies and procedures for AI risk management MANAGE-2.2 - Mechanisms to sustain AI system trustworthiness

Frequently Asked Questions

What is CVE-2021-29537?

Any TensorFlow deployment running quantized image processing ops on versions prior to 2.5.0 (or the backport releases) is at risk of heap buffer overflow, potentially leading to code execution within the TF process. Patch immediately to TF 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4 depending on your pinned version. While the local attack vector limits remote exposure, shared ML infrastructure (Jupyter clusters, multi-tenant GPU nodes, model serving APIs) significantly elevates practical risk.

Is CVE-2021-29537 actively exploited?

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

How to fix CVE-2021-29537?

1) Patch: upgrade to TF 2.5.0 or apply backports to 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4. Verify with `pip show tensorflow`. 2) Validate quantization thresholds (min/max scalars) before passing to QuantizedResizeBilinear — both must be scalar tensors with finite float values. 3) In TF Serving deployments, enforce input shape and dtype validation at the serving layer to reject malformed quantization parameters before they reach the kernel. 4) Audit multi-tenant Jupyter/Kubeflow environments for unpinned TF versions. 5) Detection: monitor for SIGSEGV/heap corruption signals in TF worker processes, unusual coredumps from model serving pods.

What systems are affected by CVE-2021-29537?

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

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

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

What is the AI security impact?

Affected AI Architectures

training pipelinesmodel servinginference optimization pipelinesedge/mobile model deploymentmulti-tenant ML platforms

MITRE ATLAS Techniques

AML.T0010.001 AI Software
AML.T0043.003 Manual Modification
AML.T0049 Exploit Public-Facing Application

Compliance Controls Affected

EU AI Act: Article 15
ISO 42001: A.6.2.3
NIST AI RMF: GOVERN-1.1, MANAGE-2.2

What are the technical details?

Original Advisory

TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a heap buffer overflow in `QuantizedResizeBilinear` by passing in invalid thresholds for the quantization. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/50711818d2e61ccce012591eeb4fdf93a8496726/tensorflow/core/kernels/quantized_resize_bilinear_op.cc#L705-L706) assumes that the 2 arguments are always valid scalars and tries to access the numeric value directly. 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-privileged access to a shared ML platform (e.g., a data scientist account on a Kubeflow cluster, or a shared Jupyter notebook server) crafts a TF graph operation invoking QuantizedResizeBilinear with malformed quantization min/max threshold tensors (e.g., non-scalar tensors or tensors with invalid shapes). When the graph executes, the kernel reads quantization thresholds without bounds checking, triggering a heap buffer overflow. In a multi-tenant GPU node, this could be used to corrupt adjacent memory regions, potentially escalating to code execution within the TF process and enabling lateral movement to access other tenants' model weights, training data, or API credentials stored in the same environment.

Weaknesses (CWE)

CWE-787 — Out-of-bounds Write: The product writes data past the end, or before the beginning, of the intended buffer.

  • [Requirements] Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, many languages that perform their own memory management, such as Java and Perl, are not subject to buffer overflows. Other languages, such as Ada and C#, typically provide overflow protection, but the protection can be disabled by the programmer. Be wary that a language's interface to native code may still be subject to overflows, even if the language itself is theoretically safe.
  • [Architecture and Design] Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. Examples include the Safe C String Library (SafeStr) by Messier and Viega [REF-57], and the Strsafe.h library from Microsoft [REF-56]. These libraries provide safer versions of overflow-prone string-handling functions.

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