CVE-2021-29523: Denial of Service in TensorFlow
Summary
CVE-2021-29523: 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
< 69c68ecbb24dff3fa0e46da0d16c821a2dd22d7c
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-29523 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 is widely used in various industries and applications.
Vulnerability Detail
The vulnerability (CVE-2021-29523) in TensorFlow allows an attacker to trigger a denial of service by exploiting a CHECK-fail in the tf.raw_ops.AddManySparseToTensorsMap function. The implementation of this function takes the values specified in the sparse_shape parameter as dimensions for the output shape. However, the TensorShape constructor used in this implementation triggers a CHECK operation when the InitDims function returns a non-OK status. This can be exploited by an attacker to cause a denial of service by providing malicious input that triggers the CHECK-failure. The vulnerability affects versions of TensorFlow up to 2.4.2.
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 known workaround for this vulnerability. It is recommended to apply the fix by updating to TensorFlow 2.5.0 or later.
Conclusion
The vulnerability in TensorFlow (CVE-2021-29523) allows an attacker to trigger a denial of service by exploiting a CHECK-fail in the tf.raw_ops.AddManySparseToTensorsMap function. Users are advised to update their TensorFlow installations to version 2.5.0 or later to mitigate this vulnerability. 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, libraries, and resources for building and deploying machine learning models.
This vulnerability allows an attacker to trigger a denial of service in TensorFlow, potentially disrupting the availability of machine learning services or applications that rely on TensorFlow.
Versions of TensorFlow up to 2.4.2 are affected by this vulnerability.
To fix this vulnerability, update your TensorFlow installation to version 2.5.0 or later.
There is no known workaround for this vulnerability. It is recommended to update to the fixed version of TensorFlow.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.