CVE-2021-29575: TensorFlow GPU - Denial of Service Vulnerability
Summary
CVE-2021-29575: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-gpu across 5 version ranges.
>= 2.2.0, < 2.2.3
< 2.2.0rc0
>= 2.3.0, < 2.3.3
>= 2.4.0, < 2.4.2
< ecf768cbe50cedc0a45ce1ee223146a3d3d26d23
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-29575 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 GPU is a variant of TensorFlow that leverages GPU acceleration for faster computation. It is widely used in various industries for deep learning tasks.
Vulnerability Detail
The vulnerability (CVE-2021-29575) exists in the implementation of tf.raw_ops.ReverseSequence in TensorFlow GPU. The affected code fails to validate the seq_dim and batch_dim arguments, allowing for potential stack overflow or CHECK-failure denial of service attacks. Negative values for seq_dim can result in stack overflow, while invalid values of batch_dim can trigger a CHECK-failure. The impact of this vulnerability depends on the version of Eigen code used to implement the operation. The issue has been identified and a fix will be included in TensorFlow 2.5.0. Additionally, the fix will be backported to TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3, and TensorFlow 2.1.4, as these versions are also affected and within the supported range.
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.2.0rc02.2.0rc0pip install --upgrade "tensorflow-gpu==2.2.0rc0" -
>= 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 temporary workaround, you can avoid using the tf.raw_ops.ReverseSequence operation with negative or invalid values for seq_dim and batch_dim. Ensure that the arguments passed to the operation are valid and within the expected range. Here is an example of how to use the operation safely:
import tensorflow as tf
# Define input tensor
input_tensor = tf.constant([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
# Define sequence lengths
sequence_lengths = tf.constant([3, 2, 1])
# Reverse the sequences
reversed_sequences = tf.reverse_sequence(input_tensor, sequence_lengths, seq_axis=1, batch_axis=0)
Conclusion
The vulnerability (CVE-2021-29575) in TensorFlow GPU's tf.raw_ops.ReverseSequence operation can lead to denial of service attacks. It is crucial to update TensorFlow GPU to version 2.5.0 or the corresponding patched versions (2.4.2, 2.3.3, 2.2.3, or 2.1.4) to mitigate this vulnerability. Regularly updating your TensorFlow GPU installation is recommended to stay protected against potential security risks. For further assistance or support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-gpu →
FAQ
TensorFlow GPU is a variant of TensorFlow that utilizes GPU acceleration for faster computation. It is commonly used in deep learning tasks to leverage the parallel processing power of GPUs.
The vulnerability allows for potential denial of service attacks, leading to stack overflow or CHECK-failures. The severity of the impact depends on the version of Eigen code used in the implementation.
The vulnerability affects TensorFlow GPU versions 2.4.2, 2.3.3, 2.2.3, and 2.1.4. These versions are within the supported range and will receive the necessary patches.
To fix the vulnerability, update TensorFlow GPU to version 2.5.0 once it is released. If you are using an affected version, update to the corresponding patched version (2.4.2, 2.3.3, 2.2.3, or 2.1.4). Regularly updating your TensorFlow GPU installation is recommended.
Yes, as a temporary workaround, avoid using the tf.raw_ops.ReverseSequence operation with negative or invalid values for seq_dim and batch_dim. Ensure the arguments passed to the operation are valid and within the expected range.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.