CVE-2021-29578: TensorFlow Heap Buffer Overflow in tf.raw_ops.FractionalAvgPoolGrad

tensorflow-cpu Updated 02 Oct 2025

Summary

14/05/2021
Yes i
Unrated
Not published

CVE-2021-29578: 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 < 12c727cee857fa19be717f336943d95fca4ffe4f

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-29578 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

TensorFlow is an end-to-end open source platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning models. TensorFlow includes various operations for pooling and gradient calculations, including the tf.raw_ops.FractionalAvgPoolGrad operation. This operation is used to compute the gradients of the fractional average pooling function. However, a vulnerability has been discovered in the implementation of this operation, which can lead to a heap buffer overflow.

Vulnerability Detail

The vulnerability in tf.raw_ops.FractionalAvgPoolGrad arises from a failure to validate the pooling sequence arguments against the out_backprop tensor shape. This can result in a heap buffer overflow, potentially leading to arbitrary code execution or a denial of service condition. The issue affects versions of TensorFlow from 0 to 2.1.4, 2.2.0 to 2.2.3, 2.3.0 to 2.3.3, and 2.4.0 to 2.4.2. The TensorFlow team has addressed the vulnerability in TensorFlow 2.5.0 and has also backported the fix to versions 2.4.2, 2.3.3, 2.2.3, and 2.1.4.

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 workaround, if immediate update or patching is not feasible, it is recommended to avoid using the tf.raw_ops.FractionalAvgPoolGrad operation in production environments until the vulnerability is addressed. Alternatively, developers can consider implementing their own custom gradient calculation for fractional average pooling to mitigate the risk.

Conclusion

The vulnerability in tf.raw_ops.FractionalAvgPoolGrad can lead to a heap buffer overflow in TensorFlow, potentially resulting in arbitrary code execution or a denial of service condition. It is crucial to update to TensorFlow 2.5.0 or apply the relevant patches to mitigate this vulnerability. If immediate update or patching is not possible, it is recommended to avoid using the affected operation in production environments. For further support on 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 resources for building and deploying machine learning models.

tf.raw_ops.FractionalAvgPoolGrad is an operation in TensorFlow used to compute the gradients of the fractional average pooling function.

A heap buffer overflow is a type of software vulnerability where a program writes data beyond the bounds of a buffer allocated in the heap, potentially overwriting adjacent memory and leading to various security issues.

The vulnerability in tf.raw_ops.FractionalAvgPoolGrad could potentially allow an attacker to execute arbitrary code or cause a denial of service condition.

You can use the Vulert Playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Simply provide your Pipfile.lock and the playground will analyze it for any open-source vulnerabilities, including this one.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow-cpu.

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