CVE-2021-29533: Denial of Service in TensorFlow
Summary
CVE-2021-29533: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu 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
< b432a38fe0e1b4b904a6c222cbce794c39703e87
Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓
Also tracked for
- tensorflow · Bitnami
- tensorflow · PyPI
- tensorflow · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-29533 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 supports a wide range of platforms and devices, making it accessible and versatile for different applications. However, a vulnerability has been discovered in TensorFlow that can lead to a denial of service attack.
Vulnerability Detail
The vulnerability in TensorFlow (CVE-2021-29533) allows an attacker to trigger a denial of service by exploiting a CHECK failure in the tf.raw_ops.DrawBoundingBoxes function. The implementation of this function uses CHECK_* assertions instead of OP_REQUIRES to validate user-controlled inputs. While OP_REQUIRES allows returning an error condition to the user, the CHECK_* macros result in a program crash if the condition is false. In this case, passing an empty image to tf.raw_ops.DrawBoundingBoxes results in a CHECK failure due to a false assertion. The height of the image is expected to be non-zero, but when it is zero, the assertion fails and the program execution is aborted. This vulnerability can be exploited by an attacker to disrupt the availability of TensorFlow applications.
How To Fix
Latest published version: 2.21.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-cpu==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-cpu==2.2.0rc0" -
>= 2.2.0, < 2.3.0rc02.3.0rc0pip install --upgrade "tensorflow-cpu==2.3.0rc0" -
>= 2.3.0, < 2.3.42.3.4pip install --upgrade "tensorflow-cpu==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow-cpu==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
As a temporary workaround, users can validate the input images before passing them to the tf.raw_ops.DrawBoundingBoxes function. By checking the height of the image and ensuring it is non-zero, the vulnerability can be mitigated. Here is an example of how to perform this validation in Python:
image_height = get_image_height(image)
if image_height > 0:
tf.raw_ops.DrawBoundingBoxes(image, ...)
else:
# Handle the case of an empty image
...
Conclusion
In conclusion, the vulnerability (CVE-2021-29533) in TensorFlow can be exploited to trigger a denial of service attack. The fix for this vulnerability will be included in TensorFlow 2.5.0 and backported to earlier versions. Users are advised to update their installations to the latest patched version as soon as it becomes available. In the meantime, a temporary workaround is available by validating the input images before passing them to the vulnerable function. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-cpu →
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.
This vulnerability allows an attacker to trigger a denial of service attack by exploiting a CHECK failure in TensorFlow. It can lead to the disruption of availability for TensorFlow applications.
The vulnerability will be fixed in TensorFlow 2.5.0. Users are advised to update their TensorFlow installations to the latest patched version as soon as it becomes available.
Yes, older versions of TensorFlow, including TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3, and TensorFlow 2.1.4, are also affected by this vulnerability. The fix will be backported to these versions as well.
Yes, as a temporary workaround, users can validate the input images before passing them to the vulnerable function. By checking the height of the image and ensuring it is non-zero, the vulnerability can be mitigated.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.