CVE-2021-29569: TensorFlow - Out-of-Bounds Read in tf.raw_ops.MaxPoolGradWithArgmax

tensorflow Updated 02 Oct 2025

Summary

06/03/2024
Yes i
High
Not published

CVE-2021-29569: Heap out of bounds read in RequantizationRange. 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-29569 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 Your last release was probably never penetration tested 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 end-to-end open source platform for machine learning. It provides a comprehensive ecosystem for building and deploying machine learning models. TensorFlow includes various operations and functions to perform tasks such as data preprocessing, model training, and inference. However, a vulnerability has been discovered in the implementation of tf.raw_ops.MaxPoolGradWithArgmax function, which can lead to out-of-bounds reads in heap allocated data.

Vulnerability Detail

The vulnerability (CVE-2021-29569) arises from the assumption made in the implementation of tf.raw_ops.MaxPoolGradWithArgmax that the input_min and input_max tensors have at least one element. If these tensors are empty, accessing the 0th element results in a read outside the bounds of the allocated data. An attacker can exploit this by providing specially crafted inputs, potentially leading to information disclosure or arbitrary code execution. The vulnerability affects TensorFlow versions 0 and 2.1.4 to 2.4.2.

How To Fix

Fixed versions by release line

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

  • < 2.1.4 2.1.4
  • >= 2.2.0, < 2.2.3 2.2.3
  • >= 2.3.0, < 2.3.3 2.3.3
  • >= 2.4.0, < 2.4.2 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 avoid passing empty tensors (input_min and input_max) to the tf.raw_ops.MaxPoolGradWithArgmax function. By ensuring that these tensors have at least one element, the vulnerability can be mitigated. Here is an example of how to check and handle empty tensors in Python:

if tf.size(input_min) > 0 and tf.size(input_max) > 0:
    # Call tf.raw_ops.MaxPoolGradWithArgmax
else:
    # Handle empty tensors

Conclusion

The vulnerability in TensorFlow's tf.raw_ops.MaxPoolGradWithArgmax function can result in out-of-bounds reads in heap allocated data. It is crucial to update to the fixed versions of TensorFlow once they are released. Regularly checking for updates and promptly applying them is recommended to maintain the security of TensorFlow deployments. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

TensorFlow is an open source platform for machine learning that provides a comprehensive ecosystem for building and deploying machine learning models.

The vulnerability can potentially lead to information disclosure or arbitrary code execution if an attacker supplies specially crafted inputs.

The vulnerability affects TensorFlow versions 0 and 2.1.4 to 2.4.2.

The vulnerability will be fixed in TensorFlow 2.5.0. Patches will also be backported to TensorFlow 2.4.2, 2.3.3, 2.2.3, and 2.1.4. It is recommended to update to the fixed versions as soon as they are available.

Yes, as a temporary workaround, users can ensure that the input_min and input_max tensors passed to tf.raw_ops.MaxPoolGradWithArgmax have at least one element.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

How To Fix

Fixed versions by release line

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

  • < 2.1.4 2.1.4
  • >= 2.2.0, < 2.2.3 2.2.3
  • >= 2.3.0, < 2.3.3 2.3.3
  • >= 2.4.0, < 2.4.2 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