CVE-2021-29531: Denial of Service Vulnerability in TensorFlow
Summary
CVE-2021-29531: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu 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
< 26eb323554ffccd173e8a79a8c05c15b685ae4d1
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-29531 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 community resources that enable researchers and developers to build and deploy machine learning models. TensorFlow supports various data formats and provides functionalities for image processing, including PNG encoding. However, a vulnerability has been discovered in the PNG encoding implementation of TensorFlow, which can be exploited to mount a denial of service attack.
Vulnerability Detail
The vulnerability in TensorFlow's PNG encoding implementation allows an attacker to trigger a CHECK fail by providing an empty input tensor as the pixel data. The implementation only validates the total number of pixels in the image, without checking if the tensor is empty or if the associated buffer is null. As a result, when calling the WriteImageToBuffer function with a null image argument, the CHECK_NOTNULL assertion fails, leading to an abort and a stacktrace being printed. This vulnerability can be exploited to cause a denial of service by sending an empty matrix for encoding.
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.1.42.1.4pip install --upgrade "tensorflow-cpu==2.1.4" -
>= 2.2.0, < 2.2.32.2.3pip install --upgrade "tensorflow-cpu==2.2.3" -
>= 2.3.0, < 2.3.32.3.3pip install --upgrade "tensorflow-cpu==2.3.3" -
>= 2.4.0, < 2.4.22.4.2pip install --upgrade "tensorflow-cpu==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 mentioned for this vulnerability. Users are recommended to apply the fix provided by updating to the patched versions of TensorFlow.
Conclusion
The vulnerability in TensorFlow's PNG encoding implementation can be exploited to mount a denial of service attack. Users are advised to update their TensorFlow installations to the patched versions as soon as they become available. For further support on vulnerability remediation, you can contact DevNack.com.
See every vulnerability recorded for tensorflow-cpu →
FAQ
TensorFlow is an open source platform for machine learning that provides tools and libraries for building and deploying machine learning models.
This vulnerability allows an attacker to mount a denial of service attack by triggering a CHECK fail in the PNG encoding implementation of TensorFlow.
The vulnerability can be fixed by updating TensorFlow to the patched versions: TensorFlow 2.5.0, TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3, or TensorFlow 2.1.4.
No specific workaround is mentioned for this vulnerability. It is recommended to update to the patched versions of TensorFlow.
For more information about this vulnerability, you can refer to the official advisory and the GitHub repository of TensorFlow.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.