CVE-2021-41218: TensorFlow GPU - Division by 0 in AllToAll Shape Inference

tensorflow-gpu Updated 02 Oct 2025

Summary

05/11/2021
Yes i
Unrated
Not published

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

< 2.4.4 >= 2.5.0, < 2.5.2 >= 2.6.0, < 2.6.1 >= 2.7.0rc0, < 2.7.0 < a8ad3e5e79c75f36edb81e0ba3f3c0c5442aeddc

Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓

Also tracked for

The same CVE-2021-41218 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 Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

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 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-41218) exists in TensorFlow GPU versions prior to 2.7.0. It stems from a flaw in the shape inference code for the AllToAll operation. When the split_count argument is set to 0, a division by zero error occurs during execution. This vulnerability can be exploited by an attacker to cause a denial-of-service (DoS) condition or potentially execute arbitrary code. The impact of this vulnerability depends on the context in which TensorFlow GPU is used, but it poses a significant risk to systems relying on TensorFlow GPU for machine learning tasks.

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"
  • >= 2.7.0rc0, < 2.7.0 2.7.0
    pip install --upgrade "tensorflow-gpu==2.7.0"

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 crucial to update TensorFlow GPU to the fixed versions as soon as possible.

Conclusion

The vulnerability (CVE-2021-41218) in TensorFlow GPU's shape inference code for AllToAll operation can lead to a division by zero error. This vulnerability can have severe consequences, including denial-of-service and potential code execution. It is crucial to update TensorFlow GPU to the fixed versions (2.7.0 or later, or backported versions) to mitigate the risk. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for tensorflow-gpu →

Share this vulnerability

FAQ

TensorFlow GPU is a variant of TensorFlow that utilizes GPU acceleration for faster computation in machine learning tasks.

The vulnerability can lead to a division by zero error, potentially causing a denial-of-service condition or enabling arbitrary code execution.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. It requires no signup and uses your Pipfile.lock to analyze and alert for open-source vulnerabilities.

No, only versions prior to 2.7.0 are affected. However, versions 2.6.1, 2.5.2, and 2.4.4 are also impacted and have received the fix.

No, there is no known workaround for this vulnerability. Updating to the fixed versions is the recommended solution.

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"
  • >= 2.7.0rc0, < 2.7.0 2.7.0
    pip install --upgrade "tensorflow-gpu==2.7.0"

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