CVE-2021-29574: TensorFlow GPU - Null Pointer Dereference in MaxPool3DGradGrad

tensorflow-gpu Updated 02 Oct 2025

Summary

14/05/2021
Yes i
Unrated
Not published

CVE-2021-29574: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-gpu 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 < a3d9f9be9ac2296615644061b40cefcee341dcc4

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-29574 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 GPU is a variant of TensorFlow that leverages the power of GPUs for accelerated computation. It allows users to train and run machine learning models on GPU hardware, enabling faster and more efficient processing of large datasets. However, a vulnerability has been identified in the TensorFlow GPU package that can lead to a null pointer dereference in the MaxPool3DGradGrad implementation.

Vulnerability Detail

The vulnerability (CVE-2021-29574) arises from the improper handling of empty tensors in the tf.raw_ops.MaxPool3DGradGrad function of TensorFlow GPU. The implementation fails to validate whether the three tensor inputs are empty before accessing their elements. As a result, if any of the tensors is empty, the code attempts to dereference a null pointer, leading to undefined behavior. An attacker can exploit this vulnerability by supplying empty tensors as inputs, potentially causing a crash or other unintended consequences. The issue has been identified and fixed in TensorFlow 2.5.0, and patches have been backported to earlier versions.

How To Fix

Latest published version: 2.12.0 as of 22 Oct 2026

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

If updating or patching the TensorFlow GPU package is not immediately feasible, a temporary workaround is to validate the tensor inputs manually before calling the MaxPool3DGradGrad function. By checking if the tensors are empty, you can avoid triggering the null pointer dereference. Here is an example of how to perform the validation in Python:

def max_pool_3d_grad_grad_workaround(tensor1, tensor2, tensor3):
    if tensor1.size == 0 or tensor2.size == 0 or tensor3.size == 0:
        # Handle empty tensors
        return None
    else:
        # Call the MaxPool3DGradGrad function
        return tf.raw_ops.MaxPool3DGradGrad(tensor1, tensor2, tensor3)

Conclusion

In conclusion, the TensorFlow GPU package is vulnerable to a null pointer dereference issue in the MaxPool3DGradGrad implementation. This vulnerability can be exploited by providing empty tensors as inputs, potentially leading to crashes or other unintended consequences. It is crucial to update the package to version 2.5.0 or apply the provided patches to mitigate the vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow-gpu →

Share this vulnerability

FAQ

TensorFlow GPU is a variant of TensorFlow that utilizes GPU hardware for accelerated machine learning computations. It allows users to train and run machine learning models on GPUs, enabling faster processing of large datasets.

MaxPool3DGradGrad is a TensorFlow operation used in the backpropagation process of 3D max pooling. It calculates the gradients of the gradients for the input tensors of the max pooling operation.

An attacker can exploit the vulnerability by providing empty tensors as inputs to the MaxPool3DGradGrad function. This can lead to a null pointer dereference and potentially cause a crash or other unintended consequences.

Yes, the vulnerability has been fixed in TensorFlow 2.5.0. Patches have also been backported to earlier versions (2.4.2, 2.3.3, 2.2.3, and 2.1.4) to ensure their security.

To protect your application, it is recommended to update the TensorFlow GPU package to version 2.5.0 or apply the provided patches for earlier versions. This will address the vulnerability and ensure the proper handling of empty tensors.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow-gpu.

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.12.0 as of 22 Oct 2026

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