CVE-2021-29523: Denial of Service in TensorFlow-GPU
Summary
CVE-2021-29523: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-gpu 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 · PyPI
- tensorflow · PyPI
- tensorflow-cpu · 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-GPU is an open-source platform for machine learning that provides end-to-end capabilities. It is widely used for developing and deploying machine learning models. TensorFlow-GPU allows users to efficiently train and run models on GPUs, enabling faster computation and improved performance. However, a vulnerability has been identified in TensorFlow-GPU that can lead to a denial of service (DoS) attack.
Vulnerability Detail
The vulnerability (CVE-2021-29523) in TensorFlow-GPU is triggered by 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 contains a legacy code that triggers a CHECK operation when the InitDims function returns a non-OK status. This vulnerability can be exploited by an attacker to cause a DoS by providing malicious input that triggers the CHECK-fail.
How To Fix
Latest published version: 2.12.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-gpu==2.12.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-gpu==2.1.4" -
>= 2.2.0, < 2.2.32.2.3pip install --upgrade "tensorflow-gpu==2.2.3" -
>= 2.3.0, < 2.3.32.3.3pip install --upgrade "tensorflow-gpu==2.3.3" -
>= 2.4.0, < 2.4.22.4.2pip install --upgrade "tensorflow-gpu==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
As a workaround, users can apply input validation and sanitization techniques to prevent the exploitation of this vulnerability. By carefully validating and sanitizing the input provided to the AddManySparseToTensorsMap function, users can mitigate the risk of a DoS attack. Here is an example of input validation code:
import tensorflow as tf
def add_sparse_to_tensors_map(sparse_indices, sparse_values, sparse_shape):
# Perform input validation
if not isinstance(sparse_indices, tf.Tensor):
raise ValueError('sparse_indices must be a TensorFlow Tensor')
if not isinstance(sparse_values, tf.Tensor):
raise ValueError('sparse_values must be a TensorFlow Tensor')
if not isinstance(sparse_shape, tf.Tensor):
raise ValueError('sparse_shape must be a TensorFlow Tensor')
# Call the patched function
tf.raw_ops.AddManySparseToTensorsMap(sparse_indices, sparse_values, sparse_shape)
By validating the input types and ensuring they are TensorFlow Tensors, the risk of triggering the vulnerability can be reduced.
Conclusion
The vulnerability (CVE-2021-29523) in TensorFlow-GPU can lead to a denial of service (DoS) attack. It is crucial for users to upgrade their TensorFlow-GPU installations to the latest patched version (2.5.0) or the backported patched versions (2.4.2, 2.3.3, 2.2.3, and 2.1.4) to mitigate the risk. Additionally, applying input validation and sanitization techniques can help reduce the likelihood of exploitation. For further support and assistance, contact DevNack.com.
See every vulnerability recorded for tensorflow-gpu →
FAQ
TensorFlow-GPU is an open-source platform for machine learning that provides end-to-end capabilities. It allows users to efficiently train and run machine learning models on GPUs for improved performance.
This vulnerability in TensorFlow-GPU can be exploited by an attacker to trigger a denial of service (DoS) attack. By providing malicious input, the attacker can cause the affected function to fail, leading to a DoS condition.
To fix this vulnerability, users should upgrade their TensorFlow-GPU installations to the latest patched version (2.5.0). The fix has also been backported to earlier versions (2.4.2, 2.3.3, 2.2.3, and 2.1.4), so users on these versions should update to the respective patched versions.
Yes, users can apply input validation and sanitization techniques to mitigate the risk of this vulnerability. By carefully validating and sanitizing the input provided to the affected function, the risk of a DoS attack can be reduced.
For further support on vulnerability remediation and assistance in securing your TensorFlow-GPU installations, you can reach out to info@devnack.com.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.