CVE-2021-29538: Division by zero in tensorflow
Summary
CVE-2021-29538: Division by zero in Conv2DBackpropFilter. 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
- tensorflow · Bitnami
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-29538 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 community resources that enable researchers and developers to build and deploy machine learning models. TensorFlow is widely used in various domains, including computer vision, natural language processing, and reinforcement learning. However, a vulnerability has been discovered in TensorFlow that can lead to a division by zero error in the Conv2DBackpropFilter function.
Vulnerability Detail
The vulnerability (CVE-2021-29538) arises due to a lack of validation in the Conv2DBackpropFilter implementation. When certain input tensors have empty shapes, the function computes a divisor based on these shapes without checking for the case where all shapes are empty. As a result, a division by zero occurs, leading to a runtime exception. This vulnerability can be exploited by an attacker to cause a denial of service (DoS) attack. The impact of this vulnerability is considered low, with a CVSS score of 2.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.1.42.1.4pip install --upgrade "tensorflow==2.1.4" -
>= 2.2.0, < 2.2.32.2.3pip install --upgrade "tensorflow==2.2.3" -
>= 2.3.0, < 2.3.32.3.3pip install --upgrade "tensorflow==2.3.3" -
>= 2.4.0, < 2.4.22.4.2pip 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
There is no specific workaround provided for this vulnerability. The recommended approach is to update TensorFlow to the patched versions mentioned above.
Conclusion
The division by zero vulnerability in TensorFlow (CVE-2021-29538) has been addressed in the latest patched versions. Users are advised to update their TensorFlow installation to ensure the security and stability of their machine learning applications. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open-source machine learning framework developed by Google.
The impact of this vulnerability is considered low, with a CVSS score of 2.5. It can be exploited by an attacker to cause a denial of service (DoS) attack.
To fix this vulnerability, update your TensorFlow installation to one of the patched versions: TensorFlow 2.1.4, TensorFlow 2.2.3, TensorFlow 2.3.3, or TensorFlow 2.4.2.
There is no specific workaround provided for this vulnerability. It is recommended to update TensorFlow to the patched versions.
For more information regarding TensorFlow security, please consult the TensorFlow security guide.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.