CVE-2021-37645: TensorFlow CPU - Integer Overflow in QuantizeAndDequantizeV4Grad
Summary
CVE-2021-37645: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu across 3 version ranges.
>= 2.3.0, < 2.3.4
>= 2.4.0, < 2.4.3
< 96f364a1ca3009f98980021c4b32be5fdcca33a1
Fixed in 2.3.4 or 2.4.3, depending 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-37645 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 CPU is a specific package within TensorFlow that focuses on CPU-based computations. It is widely used in various industries and research fields for machine learning tasks.
Vulnerability Detail
The vulnerability (CVE-2021-37645) exists in the implementation of tf.raw_ops.QuantizeAndDequantizeV4Grad in TensorFlow CPU. It is caused by an integer overflow issue that occurs when converting a signed integer value to an unsigned one and then allocating memory based on this value. The vulnerability arises from the use of the axis value as the size argument to the absl::InlinedVector constructor, which expects an unsigned type. Due to the implicit conversion, a negative value can be transformed into a large integer, leading to memory corruption or other unintended consequences. This vulnerability can be exploited by an attacker to execute arbitrary code or cause a denial-of-service condition.
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.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
There is no specific workaround provided for this vulnerability. The recommended approach is to update TensorFlow CPU to the patched version.
Conclusion
The vulnerability (CVE-2021-37645) in TensorFlow CPU's tf.raw_ops.QuantizeAndDequantizeV4Grad function poses a risk to systems running TensorFlow CPU. It is recommended to update to the patched version (2.6.0) or apply the relevant patches to mitigate the vulnerability. Users can use the Vulert Playground at https://vulert.com/scanner to check if their TensorFlow CPU installation is affected. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-cpu →
FAQ
TensorFlow CPU is a package within TensorFlow that focuses on CPU-based computations. It provides support for running TensorFlow models on systems without GPU acceleration.
This vulnerability can be exploited by an attacker to execute arbitrary code or cause a denial-of-service condition. It poses a risk to systems running TensorFlow CPU.
The vulnerability affects TensorFlow CPU versions 2.3.0 to 2.3.4, 2.4.0 to 2.4.3, and any versions prior to 2.3.0.
You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. It analyzes your Pipfile.lock and provides real-time alerts for open-source vulnerabilities.
You can find more information about this vulnerability in the TensorFlow CPU advisory PYSEC-2021-558 at https://github.com/pypa/advisory-database/blob/main/vulns/tensorflow-cpu/PYSEC-2021-558.yaml.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.