CVE-2021-29579: TensorFlow Heap Buffer Overflow in tf.raw_ops.MaxPoolGrad

tensorflow-cpu Updated 02 Oct 2025

Summary

14/05/2021
Yes i
Unrated
Not published

CVE-2021-29579: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu across 5 version ranges.

< 2.1.4 >= 2.2.0, < 2.2.3 >= 2.3.0, < 2.3.3 >= 2.4.0, < 2.4.2 < a74768f8e4efbda4def9f16ee7e13cf3922ac5f7

Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓

Also tracked for

The same CVE-2021-29579 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

TensorFlow is an end-to-end open source platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow includes various operations and functions for different tasks, including the tf.raw_ops.MaxPoolGrad operation, which is used for computing the gradients of the max pooling operation. This operation is vulnerable to a heap buffer overflow, which can lead to memory corruption and potentially allow an attacker to execute arbitrary code or cause a denial-of-service (DoS) condition.

Vulnerability Detail

The vulnerability in TensorFlow's tf.raw_ops.MaxPoolGrad operation arises from a lack of proper bounds checking when accessing elements of the out_backprop_flat array. While the indexing of the input_backprop_flat array is guarded by a bounds check, the same validation is missing for the out_backprop_flat array. This can result in out-of-bounds (OOB) access, leading to a heap buffer overflow. An attacker could exploit this vulnerability by crafting a malicious input that triggers the OOB access, potentially leading to arbitrary code execution or a DoS condition. The vulnerability affects versions of TensorFlow up to 2.4.2.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow-cpu==2.21.0"

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 2.1.4 2.1.4
    pip install --upgrade "tensorflow-cpu==2.1.4"
  • >= 2.2.0, < 2.2.3 2.2.3
    pip install --upgrade "tensorflow-cpu==2.2.3"
  • >= 2.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow-cpu==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip install --upgrade "tensorflow-cpu==2.4.2"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary workaround, users can consider disabling or avoiding the usage of the tf.raw_ops.MaxPoolGrad operation in their TensorFlow models. By replacing this operation with alternative approaches or using different pooling operations, users can mitigate the risk of exploiting this vulnerability.

Conclusion

The vulnerability in TensorFlow's tf.raw_ops.MaxPoolGrad operation can lead to a heap buffer overflow, potentially enabling arbitrary code execution or causing a denial-of-service condition. Users are advised to update their TensorFlow installation to one of the patched versions and follow the recommended steps to fix the vulnerability. For further support and assistance with vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow-cpu →

Share this vulnerability

FAQ

TensorFlow is an open source platform for machine learning that provides a comprehensive set of tools and libraries for developing and deploying machine learning models.

tf.raw_ops.MaxPoolGrad is an operation in TensorFlow that computes the gradients of the max pooling operation. It is used in the backpropagation phase of training neural networks.

A heap buffer overflow is a type of vulnerability where a program writes data beyond the bounds of a dynamically allocated buffer in the heap. This can lead to memory corruption and potentially allow an attacker to execute arbitrary code or cause a DoS condition.

An attacker can exploit this vulnerability by crafting a malicious input that triggers the out-of-bounds access in the tf.raw_ops.MaxPoolGrad operation. This can lead to a heap buffer overflow, potentially enabling arbitrary code execution or causing a DoS condition.

To fix the vulnerability, users should update their TensorFlow installation to one of the patched versions: TensorFlow 2.5.0, TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3, or TensorFlow 2.1.4. This can be done by upgrading the TensorFlow package using the package manager or by manually installing the updated version from the official TensorFlow repository.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow-cpu.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow-cpu==2.21.0"

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 2.1.4 2.1.4
    pip install --upgrade "tensorflow-cpu==2.1.4"
  • >= 2.2.0, < 2.2.3 2.2.3
    pip install --upgrade "tensorflow-cpu==2.2.3"
  • >= 2.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow-cpu==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip install --upgrade "tensorflow-cpu==2.4.2"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback