CVE-2022-21729: Overflow and uncaught divide by zero in Tensorflow
Summary
CVE-2022-21729: Overflow and uncaught divide by zero in Tensorflow. Affects tensorflow across 3 version ranges.
< 2.5.3
>= 2.6.0, < 2.6.3
>= 2.7.0, < 2.7.1
Fixed in 2.5.3, 2.6.3 or 2.7.1, depending on the release line you run. How to fix ↓
Also tracked for
- tensorflow · Bitnami
- tensorflow-gpu · PyPI
- tensorflow-cpu · 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 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 division by zero due to an integer overflow bug.
Vulnerability Detail
The vulnerability resides in the implementation of the UnravelIndex function in Tensorflow. This function is used to convert flat indices into multi-dimensional indices. However, due to an integer overflow bug, it is possible to trigger a division by zero when passing certain values to the function. An attacker could exploit this vulnerability to cause a denial of service (DoS) condition or potentially execute arbitrary code. The impact of this vulnerability is considered moderate with a CVSS score of 6.5.
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.5.32.5.3pip install --upgrade "tensorflow==2.5.3" -
>= 2.6.0, < 2.6.32.6.3pip install --upgrade "tensorflow==2.6.3" -
>= 2.7.0, < 2.7.12.7.1pip install --upgrade "tensorflow==2.7.1"
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 mentioned for this vulnerability.
Conclusion
The vulnerability in Tensorflow has been addressed in the latest versions, and it is recommended to update to TensorFlow 2.8.0 or later. If you are using an older version, apply the patch manually. For further support on vulnerability remediation, you can reach out to DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
Tensorflow is an open-source machine learning framework developed by Google.
The vulnerability could lead to a division by zero, potentially causing a denial of service (DoS) condition or arbitrary code execution.
Update to TensorFlow 2.8.0 or later, or manually apply the patch by cherry-picking the commit https://github.com/tensorflow/tensorflow/commit/58b34c6c8250983948b5a781b426f6aa01fd47af.
No specific workaround has been mentioned for this vulnerability.
This vulnerability was reported by Yu Tian of Qihoo 360 AIVul Team.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.