CVE-2021-29576: Heap buffer overflow in tensorflow

tensorflow Updated 02 Oct 2025

Summary

21/05/2021
Yes i
Low
2.5

CVE-2021-29576: Heap buffer overflow in MaxPool3DGradGrad. Affects tensorflow across 4 version ranges.

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

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-29576 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 Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

TensorFlow is an open-source machine learning framework developed by Google. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning models. TensorFlow is widely used in various domains, including research, industry, and academia. However, a vulnerability has been discovered in TensorFlow that could lead to a heap buffer overflow.

Vulnerability Detail

The vulnerability, identified as CVE-2021-29576, specifically affects the MaxPool3DGradGrad function in TensorFlow. This function is used for gradient computation in 3D max pooling operations. The implementation of MaxPool3DGradGrad does not properly validate the initialization of Pool3dParameters, which can result in the presence of invalid data. Depending on the default initialized values, this can lead to a heap buffer overflow. An attacker could potentially exploit this vulnerability to execute arbitrary code or cause a denial-of-service condition.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow==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==2.1.4"
  • >= 2.2.0, < 2.2.3 2.2.3
    pip install --upgrade "tensorflow==2.2.3"
  • >= 2.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip install --upgrade "tensorflow==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 workaround, you can avoid using the MaxPool3DGradGrad function in your TensorFlow code until you have applied the necessary patches. Alternatively, you can consider using a different function or approach for gradient computation in 3D max pooling operations.

Conclusion

The vulnerability in TensorFlow's MaxPool3DGradGrad function can lead to a heap buffer overflow, potentially enabling arbitrary code execution or causing a denial-of-service condition. It is crucial to update TensorFlow to version 2.5.0 or later, or manually apply the provided patch. Consider using workarounds or alternative approaches until the necessary fixes are applied. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

The vulnerability can potentially allow an attacker to execute arbitrary code or cause a denial-of-service condition.

The vulnerability affects TensorFlow versions 2.1.4, 2.2.3, 2.3.3, and 2.4.2. It has been fixed in TensorFlow 2.5.0.

There are no known exploits for this vulnerability at the time of this report. However, it is recommended to apply the patches as soon as possible to mitigate any potential risks.

Yes, you can manually apply the patch by cherry-picking the commit 63c6a29d0f2d692b247f7bf81f8732d6442fad09 from the TensorFlow GitHub repository. However, it is recommended to upgrade to the latest version for better security and stability.

You can refer to the TensorFlow security guide for more information about the security model, how to contact the TensorFlow team with issues and questions, and additional details about this vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow==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==2.1.4"
  • >= 2.2.0, < 2.2.3 2.2.3
    pip install --upgrade "tensorflow==2.2.3"
  • >= 2.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip install --upgrade "tensorflow==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