CVE-2021-37677: TensorFlow GPU - Denial of Service via Invalid Arguments in tf.raw_ops.Dequantize
Summary
CVE-2021-37677: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-gpu across 3 version ranges.
>= 2.3.0, < 2.3.4
>= 2.4.0, < 2.4.3
< da857cfa0fde8f79ad0afdbc94e88b5d4bbec764
Fixed in 2.3.4 or 2.4.3, depending 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-37677 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 for building 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 and research domains for deep learning tasks.
Vulnerability Detail
The vulnerability (CVE-2021-37677) exists in the shape inference code for tf.raw_ops.Dequantize in TensorFlow GPU. It can be triggered when an attacker provides invalid arguments to the function. The shape inference implementation uses the axis parameter to select between two different values for minmax_rank, which is then used to retrieve tensor dimensions. However, the code assumes that axis can only be -1 or a value greater than -1, without validating other values. This oversight can lead to a segmentation fault (segfault) and result in a denial of service (DoS) condition. The vulnerability affects TensorFlow GPU versions 2.3.0 to 2.3.4, 2.4.0 to 2.4.3, and 2.5.0 to 2.5.1.
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.3.0, < 2.3.42.3.4pip install --upgrade "tensorflow-gpu==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow-gpu==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 avoid the vulnerability by ensuring that valid arguments are provided to the tf.raw_ops.Dequantize function. It is recommended to validate the axis parameter and only pass values of -1 or greater than -1 to avoid triggering the vulnerability. Here's an example of how to validate the axis parameter in Python:
def dequantize_with_validation(tensor, axis):
if axis < -1:
raise ValueError('Invalid axis value')
# Perform dequantization
result = tf.raw_ops.Dequantize(tensor, axis)
return result
By implementing this validation check, the vulnerability can be mitigated.
Conclusion
The vulnerability (CVE-2021-37677) in TensorFlow GPU's shape inference code for tf.raw_ops.Dequantize can be exploited by providing invalid arguments, leading to a denial of service (DoS) condition. The TensorFlow development team has addressed the issue in the GitHub commit da857cfa0fde8f79ad0afdbc94e88b5d4bbec764, which will be included in TensorFlow 2.6.0. Users of affected versions (2.3.0 to 2.3.4, 2.4.0 to 2.4.3, and 2.5.0 to 2.5.1) are advised to update their installations to the patched versions once they become available. In the meantime, a temporary workaround is to validate the axis parameter to avoid triggering the vulnerability.
See every vulnerability recorded for tensorflow-gpu →
FAQ
TensorFlow GPU is a variant of TensorFlow that utilizes GPU acceleration for faster computation. It is specifically designed to leverage the power of GPUs to accelerate machine learning tasks.
The vulnerability can lead to a denial of service (DoS) condition by triggering a segmentation fault (segfault) in TensorFlow GPU. This can result in the disruption of machine learning tasks and potentially impact the availability of the system.
The vulnerability affects TensorFlow GPU versions 2.3.0 to 2.3.4, 2.4.0 to 2.4.3, and 2.5.0 to 2.5.1. Users of these versions should update to the patched versions once they are available.
To fix the vulnerability, users should update their TensorFlow GPU installations to the patched versions. The fix will be included in TensorFlow 2.6.0, and cherrypicked commits will be applied to TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4.
Yes, as a temporary workaround, users can validate the axis parameter before passing it to the tf.raw_ops.Dequantize function. By ensuring that the axis value is either -1 or greater than -1, the vulnerability can be mitigated.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.