CVE-2021-41195: TensorFlow GPU - Denial of Service Vulnerability

tensorflow-gpu Updated 02 Oct 2025

Summary

05/11/2021
Yes i
Unrated
Not published

CVE-2021-41195: TensorFlow is an open source platform for machine learning. Affects tensorflow-gpu across 4 version ranges.

< 2.4.4 >= 2.5.0, < 2.5.2 >= 2.6.0, < 2.6.1 < e9c81c1e1a9cd8dd31f4e83676cab61b60658429

Fixed in 2.4.4, 2.5.2 or 2.6.1, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2021-41195 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

TensorFlow is an open source platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning models. TensorFlow GPU is a variant of TensorFlow that leverages the power of GPUs for accelerated computation. It allows users to train and run machine learning models on GPU hardware, enabling faster and more efficient processing of large datasets. However, a vulnerability has been discovered in TensorFlow GPU that can lead to a denial of service (DoS) attack.

Vulnerability Detail

The vulnerability (CVE-2021-41195) in TensorFlow GPU is related to the implementation of tf.math.segment_* operations. When a large segment id is provided in the segment_ids parameter, it triggers a CHECK-fail related abort, resulting in a DoS condition. This vulnerability is similar to other reported vulnerabilities in TensorFlow that are localized to specific APIs. The issue arises when the implementation computes the output shape using AddDim, which can cause a CHECK failure and lead to a std::abort if the number of elements in the tensor overflows an int64_t value. The impact of this vulnerability is the disruption of service and potential resource exhaustion on systems running TensorFlow GPU. The fix for this vulnerability will be included in TensorFlow 2.7.0, and patches will also be provided for earlier versions.

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.4.4 2.4.4
    pip install --upgrade "tensorflow-gpu==2.4.4"
  • >= 2.5.0, < 2.5.2 2.5.2
    pip install --upgrade "tensorflow-gpu==2.5.2"
  • >= 2.6.0, < 2.6.1 2.6.1
    pip install --upgrade "tensorflow-gpu==2.6.1"

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 modify the affected code to use AddDimWithStatus instead of AddDim when computing the output shape. This can prevent the CHECK failure and avoid the DoS condition. Here is an example of how the code can be modified:

import tensorflow as tf

# Original code
output_shape = tf.shape(input_tensor)

# Modified code
output_shape = tf.raw_ops.AddDimWithStatus(input=input_tensor, dim=0)

It is important to note that this workaround is not a permanent solution and should be replaced with the official fix as soon as it is available.

Conclusion

The vulnerability in TensorFlow GPU (CVE-2021-41195) can lead to a denial of service (DoS) condition, impacting the availability of services relying on TensorFlow GPU. It is crucial for users to update to the fixed versions or apply the provided patches as soon as they become available. Monitoring the official TensorFlow website and GitHub repository for updates is recommended. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow-gpu →

Share this vulnerability

FAQ

TensorFlow GPU is a variant of TensorFlow that utilizes GPU hardware for accelerated computation. It allows users to train and run machine learning models on GPUs, providing faster and more efficient processing of large datasets.

The vulnerability in TensorFlow GPU can lead to a denial of service (DoS) condition. It can cause the affected system to become unresponsive or crash, disrupting the availability of services relying on TensorFlow GPU.

To fix this vulnerability, it is recommended to update TensorFlow GPU to the latest fixed version when it becomes available. Patches will also be provided for earlier versions. Users should monitor the official TensorFlow website and GitHub repository for the release of the fixed versions and apply the updates as soon as possible.

Yes, as a temporary workaround, users can modify the affected code to use AddDimWithStatus instead of AddDim when computing the output shape. This can prevent the CHECK failure and avoid the DoS condition. However, this workaround should be replaced with the official fix as soon as it is available.

The vulnerability affects TensorFlow GPU versions 2.4.4, 2.5.2, 2.6.1, and earlier. Users of these versions should update to the fixed versions or apply the provided patches.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow-gpu.

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.4.4 2.4.4
    pip install --upgrade "tensorflow-gpu==2.4.4"
  • >= 2.5.0, < 2.5.2 2.5.2
    pip install --upgrade "tensorflow-gpu==2.5.2"
  • >= 2.6.0, < 2.6.1 2.6.1
    pip install --upgrade "tensorflow-gpu==2.6.1"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback