CVE-2021-29544: Denial of Service in TensorFlow
Summary
CVE-2021-29544: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow across 5 version ranges.
>= 2.2.0, < 2.3.0rc0
< 2.2.0rc0
>= 2.3.0, < 2.3.4
>= 2.4.0, < 2.4.3
< 20431e9044cf2ad3c0323c34888b192f3289af6b
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-29544 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, including research, industry, and academia. It allows users to build and train machine learning models using high-level APIs and provides support for distributed computing and deployment on different platforms. However, a vulnerability has been discovered in TensorFlow that can lead to a denial of service attack.
Vulnerability Detail
The vulnerability, identified as CVE-2021-29544, exists in the tf.raw_ops.QuantizeAndDequantizeV4Grad function of TensorFlow. An attacker can exploit this vulnerability by triggering a CHECK-fail in the function, which occurs due to the lack of validation for the rank of certain input tensors. As a result, these tensors are passed as they are to another function, QuantizeAndDequantizePerChannelGradientImpl, which requires the rank to be 1. This mismatch in rank triggers a CHECK failure, leading to a denial of service condition. The vulnerability affects versions of TensorFlow up to 2.4.3.
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.2.0rc02.2.0rc0pip install --upgrade "tensorflow==2.2.0rc0" -
>= 2.2.0, < 2.3.0rc02.3.0rc0pip install --upgrade "tensorflow==2.3.0rc0" -
>= 2.3.0, < 2.3.42.3.4pip install --upgrade "tensorflow==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow==2.4.3"
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
A possible workaround for this vulnerability is to add explicit rank validation for the input tensors in the QuantizeAndDequantizeV4Grad function. This can be done by modifying the implementation code to check the rank of the input_* tensors before passing them to QuantizeAndDequantizePerChannelGradientImpl. Here is an example of how the code can be modified:
# Original code
if vec<T>(input_shape.dim_size(0)) != 1:
CHECK(false) << "Rank of input_* tensors must be 1.";
# Modified code
if input_shape.dims() != 1:
CHECK(false) << "Rank of input_* tensors must be 1.";
Conclusion
In conclusion, a denial of service vulnerability has been identified in TensorFlow versions up to 2.4.3. This vulnerability can be exploited by an attacker to disrupt the service or render machine learning models unavailable. Users are advised to update their TensorFlow installations to version 2.5.0 once it is released. In the meantime, a workaround is available to mitigate the risk. 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 trigger a denial of service condition in TensorFlow, leading to disruption of service or unavailability of machine learning models.
The vulnerability affects versions of TensorFlow up to 2.4.3. TensorFlow 2.5.0 and later versions will include a fix for this vulnerability.
To fix this vulnerability, update your TensorFlow installation to the latest version once TensorFlow 2.5.0 becomes available. In the meantime, you can apply the provided workaround to mitigate the risk of exploitation.
Yes, a workaround is available for this vulnerability. You can modify the implementation code of the QuantizeAndDequantizeV4Grad function to add explicit rank validation for the input tensors. The provided workaround code demonstrates how this can be done.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.