CVE-2022-21729: TensorFlow CPU - Division by Zero Vulnerability
Summary
CVE-2022-21729: Tensorflow is an Open Source Machine Learning Framework. Affects tensorflow-cpu across 3 version ranges.
< 2.5.3
>= 2.6.0, < 2.6.3
< 58b34c6c8250983948b5a781b426f6aa01fd47af
Fixed in 2.5.3 or 2.6.3, depending on the release line you run. How to fix ↓
Also tracked for
- tensorflow · PyPI
- tensorflow · Bitnami
- tensorflow · PyPI
- tensorflow-gpu · PyPI
The same CVE-2022-21729 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 open-source machine learning framework widely used for developing and training machine learning models. It provides a comprehensive set of tools and libraries for building and deploying machine learning applications. TensorFlow CPU is a specific package within TensorFlow that focuses on running TensorFlow on CPUs. It is commonly used in environments where GPU acceleration is not available or required. This vulnerability affects versions of TensorFlow CPU up to 2.5.3, 2.6.3, and 2.7.1.
Vulnerability Detail
The vulnerability in TensorFlow CPU is related to the implementation of the UnravelIndex function. Due to an integer overflow bug, a division by zero can occur, leading to potential crashes or unexpected behavior in applications utilizing this function. An attacker could potentially exploit this vulnerability to cause a denial-of-service (DoS) attack or execute arbitrary code. The issue has been identified and fixed in TensorFlow 2.8.0, and the fix has also been backported to TensorFlow 2.7.1, 2.6.3, and 2.5.3 to ensure compatibility and support for older 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.5.32.5.3pip install --upgrade "tensorflow-cpu==2.5.3" -
>= 2.6.0, < 2.6.32.6.3pip install --upgrade "tensorflow-cpu==2.6.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 workaround, users can temporarily avoid using the UnravelIndex function or any code that relies on it until the package is updated. By avoiding the vulnerable code, the risk of encountering the division by zero vulnerability is mitigated. However, this workaround may not be feasible in all scenarios, especially if the function is critical for the application's functionality.
Conclusion
The division by zero vulnerability in TensorFlow CPU's UnravelIndex function can have serious consequences, including crashes, unexpected behavior, and potential exploitation. It is crucial to update TensorFlow CPU to version 2.8.0 or apply the provided patches for older versions to mitigate the risk. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-cpu →
FAQ
TensorFlow CPU is a package within the TensorFlow framework that allows running TensorFlow on CPUs instead of GPUs. It is commonly used in environments where GPU acceleration is not available or required.
The vulnerability can lead to division by zero, causing crashes or unexpected behavior in applications utilizing the UnravelIndex function. It could potentially be exploited for denial-of-service (DoS) attacks or arbitrary code execution.
Versions up to 2.5.3, 2.6.3, and 2.7.1 of TensorFlow CPU are affected by this vulnerability.
Yes, the vulnerability has been fixed in TensorFlow 2.8.0. Additionally, patches have been released for TensorFlow 2.7.1, 2.6.3, and 2.5.3 to ensure compatibility and support for older versions.
Detailed instructions on how to update TensorFlow CPU can be found in the official TensorFlow documentation. It is recommended to update to version 2.8.0 or apply the respective patches for older versions.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.