CVE-2021-29579: TensorFlow: heap buffer overflow in MaxPoolGrad kernel

HIGH PoC AVAILABLE
Published May 14, 2021
CISO Take

TensorFlow's MaxPoolGrad operation contains a heap buffer overflow (OOB write) exploitable by any local user with low privileges — a serious risk in shared ML training clusters and multi-tenant Jupyter environments. Patch immediately to TF 2.5.0 or the respective backport (2.4.2, 2.3.3, 2.2.3, 2.1.4). Treat unpatched TensorFlow training nodes as high-risk lateral movement surfaces, particularly in Kubernetes-based ML pipelines where service accounts carry elevated permissions.

What is the risk?

CVSS 7.8 HIGH with local attack vector, low complexity, and low privileges required. While remote exploitation requires indirect access (malicious notebook submission, shared cluster), the combination of low complexity and full C/I/A impact makes this dangerous in multi-tenant ML environments. Not in CISA KEV; no evidence of active in-the-wild exploitation. Risk is materially elevated for organizations running shared GPU/TPU training infrastructure where multiple users submit jobs to the same nodes.

What systems are affected?

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

6 steps
  1. Upgrade TensorFlow to 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4 depending on your current branch — confirm with python -c 'import tensorflow as tf; print(tf.__version__)' on all hosts.

  2. Inventory all TensorFlow deployments: include training clusters, CI/CD pipelines, notebook servers, and model serving containers.

  3. Apply network segmentation to isolate ML training nodes from production systems.

  4. Restrict local shell access to training nodes — audit which accounts have SSH/console access and apply least privilege.

  5. Enable process and file integrity monitoring on TF training hosts.

  6. For Kubernetes ML pipelines: audit service account permissions on nodes running TensorFlow training jobs.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Art. 17 - Quality management system — technical robustness
ISO 42001
A.6.2.6 - AI system lifecycle — software component integrity
NIST AI RMF
MANAGE 2.2 - Mechanisms to sustain the value of deployed AI

Frequently Asked Questions

What is CVE-2021-29579?

TensorFlow's MaxPoolGrad operation contains a heap buffer overflow (OOB write) exploitable by any local user with low privileges — a serious risk in shared ML training clusters and multi-tenant Jupyter environments. Patch immediately to TF 2.5.0 or the respective backport (2.4.2, 2.3.3, 2.2.3, 2.1.4). Treat unpatched TensorFlow training nodes as high-risk lateral movement surfaces, particularly in Kubernetes-based ML pipelines where service accounts carry elevated permissions.

Is CVE-2021-29579 actively exploited?

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

How to fix CVE-2021-29579?

1. Upgrade TensorFlow to 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4 depending on your current branch — confirm with `python -c 'import tensorflow as tf; print(tf.__version__)'` on all hosts. 2. Inventory all TensorFlow deployments: include training clusters, CI/CD pipelines, notebook servers, and model serving containers. 3. Apply network segmentation to isolate ML training nodes from production systems. 4. Restrict local shell access to training nodes — audit which accounts have SSH/console access and apply least privilege. 5. Enable process and file integrity monitoring on TF training hosts. 6. For Kubernetes ML pipelines: audit service account permissions on nodes running TensorFlow training jobs.

What systems are affected by CVE-2021-29579?

This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, shared notebook environments, ML training clusters.

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

CVE-2021-29579 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 servingshared notebook environmentsML training clusters

MITRE ATLAS Techniques

AML.T0010.001 AI Software
AML.T0049 Exploit Public-Facing Application

Compliance Controls Affected

EU AI Act: Art. 17
ISO 42001: A.6.2.6
NIST AI RMF: MANAGE 2.2

What are the technical details?

Original Advisory

TensorFlow is an end-to-end open source platform for machine learning. The implementation of `tf.raw_ops.MaxPoolGrad` is vulnerable to a heap buffer overflow. The implementation(https://github.com/tensorflow/tensorflow/blob/ab1e644b48c82cb71493f4362b4dd38f4577a1cf/tensorflow/core/kernels/maxpooling_op.cc#L194-L203) fails to validate that indices used to access elements of input/output arrays are valid. Whereas accesses to `input_backprop_flat` are guarded by `FastBoundsCheck`, the indexing in `out_backprop_flat` can result in OOB access. 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 shell access to a shared GPU training server — for example, a data scientist account on a multi-tenant ML cluster — crafts a malicious TensorFlow script invoking `tf.raw_ops.MaxPoolGrad` with specially crafted tensor shapes that trigger the OOB write in `out_backprop_flat`. The heap corruption enables arbitrary code execution in the TensorFlow process context. If the training job runs under a Kubernetes service account with broad permissions (common in MLOps pipelines), the attacker escalates to cluster-wide access — enabling trained model exfiltration, training data theft, or lateral movement to adjacent production systems sharing the cluster.

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