CVE-2021-29610: TensorFlow - Heap Underflow in QuantizeAndDequantizeV2
Summary
CVE-2021-29610: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu across 5 version ranges.
>= 2.2.0, < 2.3.0rc0
< 2.2.0rc0
>= 2.3.0, < 2.3.4
>= 2.4.0, < 2.4.3
< c5b0d5f8ac19888e46ca14b0e27562e7fbbee9a9
Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓
Also tracked for
- tensorflow · Bitnami
- tensorflow · PyPI
- tensorflow · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-29610 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
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.
No signup required · Results in about 60 seconds
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 is widely used in various domains, including research, industry, and academia. The vulnerability described here affects the tf.raw_ops.QuantizeAndDequantizeV2 function in TensorFlow.
Vulnerability Detail
The vulnerability in tf.raw_ops.QuantizeAndDequantizeV2 arises from a validation issue with the axis argument. The validation logic in the function allows for invalid values of axis, leading to a heap underflow. An attacker can exploit this vulnerability to read from or write to other data on the heap, potentially resulting in unauthorized access or data corruption. 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.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.2.0rc02.2.0rc0pip install --upgrade "tensorflow-cpu==2.2.0rc0" -
>= 2.2.0, < 2.3.0rc02.3.0rc0pip install --upgrade "tensorflow-cpu==2.3.0rc0" -
>= 2.3.0, < 2.3.42.3.4pip install --upgrade "tensorflow-cpu==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow-cpu==2.4.3"
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, you can avoid using the tf.raw_ops.QuantizeAndDequantizeV2 function with invalid values for the axis argument. Review your codebase and ensure that proper input validation and sanitization are in place to prevent the use of invalid values. Additionally, consider implementing runtime checks or input validation mechanisms to detect and handle any potential misuse of this function.
Conclusion
The vulnerability in TensorFlow's tf.raw_ops.QuantizeAndDequantizeV2 function has been identified and fixed in TensorFlow 2.5.0. It is crucial to update your TensorFlow installation to the latest version or apply the provided patches to ensure the security and integrity of your machine learning applications. If you have any further questions or need assistance with vulnerability remediation, please reach out to DevNack.com.
See every vulnerability recorded for tensorflow-cpu →
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.
This vulnerability allows attackers to read from or write to other data on the heap, potentially leading to unauthorized access or data corruption.
The vulnerability affects TensorFlow versions 2.1.4, 2.2.3, 2.3.3, and 2.4.2. These versions are still within the supported range and have received patches to address the issue.
You can use the Vulert Playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. The playground allows you to analyze your Pipfile.lock and provides real-time alerts for open-source vulnerabilities.
For more information about this vulnerability, you can refer to the official TensorFlow advisory (https://github.com/pypa/advisory-database/blob/main/vulns/tensorflow-cpu/PYSEC-2021-538.yaml). Additionally, you can reach out to info@devnack.com for further support on vulnerability remediation.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.