CVE-2021-29528: TensorFlow Division by 0 in QuantizedMul
Summary
CVE-2021-29528: 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
< a1b11d2fdd1e51bfe18bb1ede804f60abfa92da6
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-29528 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 domains and applications, including computer vision, natural language processing, and deep learning. This vulnerability affects the TensorFlow package and specifically impacts the tf.raw_ops.QuantizedMul function.
Vulnerability Detail
The vulnerability in TensorFlow arises from a division by zero in the tf.raw_ops.QuantizedMul function. The implementation of this function performs a division operation using a value controlled by the caller. An attacker can exploit this by providing a zero value, triggering a division by zero error. This vulnerability can lead to a Denial of Service (DoS) condition, causing the affected TensorFlow application to crash or become unresponsive. The issue has been identified and a fix will be included in TensorFlow 2.5.0. Additionally, the fix will be backported to TensorFlow versions 2.4.2, 2.3.3, 2.2.3, and 2.1.4, as these versions are still within the supported range.
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. However, as a general best practice, it is recommended to ensure that user input is properly validated and sanitized before being used in mathematical operations. Implementing input validation and error handling mechanisms can help mitigate the risk of such vulnerabilities.
Conclusion
In conclusion, the vulnerability in TensorFlow's tf.raw_ops.QuantizedMul function can be exploited by an attacker to trigger a division by zero error, leading to a Denial of Service (DoS) condition. To mitigate this vulnerability, it is crucial to update the TensorFlow package to the fixed versions: TensorFlow 2.5.0, TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3, or TensorFlow 2.1.4. Regularly updating software and following best practices for input validation can help ensure the security and stability of TensorFlow applications. For further support on vulnerability remediation, you can contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open source platform for machine learning that provides a comprehensive set of tools and resources for developing and deploying machine learning models.
The vulnerability can lead to a Denial of Service (DoS) condition, causing the affected TensorFlow application to crash or become unresponsive.
To fix this vulnerability, it is recommended to update the TensorFlow package to the latest version available. Users should upgrade to TensorFlow 2.5.0 once it is released. For users on older versions, it is advised to upgrade to the respective fixed versions: TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3, or TensorFlow 2.1.4.
There is no specific workaround provided for this vulnerability. However, implementing input validation and error handling mechanisms can help mitigate the risk of such vulnerabilities.
For more information about this vulnerability, you can refer to the official TensorFlow advisory database: https://github.com/pypa/advisory-database/blob/main/vulns/tensorflow/PYSEC-2021-165.yaml
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.