CVE-2021-29527: TensorFlow - Division by 0 in QuantizedConv2D
Summary
CVE-2021-29527: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow across 5 version ranges.
< 2.1.4
>= 2.2.0, < 2.2.3
>= 2.3.0, < 2.3.3
>= 2.4.0, < 2.4.2
< cfa91be9863a91d5105a3b4941096044ab32036b
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-29527 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 developing and deploying machine learning models. TensorFlow is widely used in various industries and research domains for tasks such as image recognition, natural language processing, and recommendation systems. However, a vulnerability has been discovered in TensorFlow that allows an attacker to trigger a division by 0 in the tf.raw_ops.QuantizedConv2D function.
Vulnerability Detail
The vulnerability arises due to a division operation performed in the implementation of tf.raw_ops.QuantizedConv2D. The divisor value in the division operation is controlled by the caller, allowing an attacker to provide a value of 0 and trigger a division by 0 error. This vulnerability can be exploited by an attacker to cause a denial of service (DoS) condition or potentially execute arbitrary code in the context of the affected application. The impact of this vulnerability depends on the specific usage of TensorFlow in the application and the security measures in place.
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
As a workaround, users can validate the divisor value before calling the tf.raw_ops.QuantizedConv2D function to prevent a division by 0. This can be done by checking if the divisor is 0 and handling the situation accordingly. Here is an example of how to implement this workaround in Python:
if divisor != 0:
tf.raw_ops.QuantizedConv2D(...)
else:
# Handle the division by 0 error
...
Conclusion
In conclusion, a division by 0 vulnerability has been discovered in TensorFlow's tf.raw_ops.QuantizedConv2D function. This vulnerability can be mitigated by upgrading to TensorFlow 2.5.0 or later, or by updating to the fixed versions for affected versions. Users can also implement a workaround to validate the divisor value before calling the function. Regularly updating TensorFlow and other dependencies is crucial for maintaining the security of 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 platform for machine learning that provides tools and resources for developing and deploying machine learning models.
This vulnerability can be exploited by an attacker to cause a denial of service (DoS) condition or potentially execute arbitrary code in the context of the affected application.
The vulnerability affects TensorFlow versions 2.1.4 and later, including versions 2.2.3, 2.3.3, 2.4.2, and 2.5.0 (prior to the fix).
To fix this vulnerability, it is recommended to upgrade to TensorFlow version 2.5.0 or later. Alternatively, users of affected versions can update to the respective fixed versions: 2.4.2, 2.3.3, 2.2.3, or 2.1.4.
Yes, a workaround is available. Users can validate the divisor value before calling the tf.raw_ops.QuantizedConv2D function to prevent a division by 0 error.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.