CVE-2021-29569: Heap out of bounds read in tensorflow

tensorflow Updated 02 Oct 2025

Summary

21/05/2021
Yes i
Low
2.5

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 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 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 potentially lead to a heap out of bounds read.

Vulnerability Detail

The vulnerability exists in the implementation of tf.raw_ops.MaxPoolGradWithArgmax in TensorFlow. Attackers can exploit this vulnerability by supplying specially crafted inputs. When the input_min and input_max tensors are empty, the implementation assumes they have at least one element and attempts to access the first element. This results in a read outside the bounds of the heap allocated data. The impact of this vulnerability can vary depending on the specific usage scenario, but it has the potential to lead to information disclosure or denial of service.

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 ensure that the input_min and input_max tensors have at least one element before passing them to tf.raw_ops.RequantizationRange. This can be done by checking the size of the tensors and adding a dummy element if they are empty. Here is an example of how to implement this workaround in Python:

import tensorflow as tf

input = tf.constant([1], shape=[1], dtype=tf.qint32)
input_max = tf.constant([], dtype=tf.float32)
input_min = tf.constant([], dtype=tf.float32)

if input_max.shape.num_elements() == 0:
    input_max = tf.constant([0.0], dtype=tf.float32)
if input_min.shape.num_elements() == 0:
    input_min = tf.constant([0.0], dtype=tf.float32)

tf.raw_ops.RequantizationRange(input=input, input_min=input_min, input_max=input_max)

Conclusion

In conclusion, a heap out of bounds read vulnerability has been discovered in TensorFlow. This vulnerability can be exploited by attackers to read outside the bounds of heap allocated data. It is recommended to update to the latest patched version of TensorFlow or apply the provided workaround to mitigate the risk. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

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.

The impact of this vulnerability can vary depending on the specific usage scenario, but it has the potential to lead to information disclosure or denial of service.

The vulnerability has been patched in TensorFlow commit ef0c008ee84bad91ec6725ddc42091e19a30cf0e. It is recommended to update to the latest patched version of TensorFlow as soon as it becomes available.

Yes, you can ensure that the input_min and input_max tensors have at least one element before passing them to tf.raw_ops.RequantizationRange. This can be done by checking the size of the tensors and adding a dummy element if they are empty.

You can consult the TensorFlow security guide for more information regarding the security model and how to contact the TensorFlow team with any issues or questions.

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