CVE-2021-41204: TensorFlow GPU - Resource Tensor Deep Copy Segfault

tensorflow-gpu Updated 02 Oct 2025

Summary

05/11/2021
Yes i
Unrated
Not published

CVE-2021-41204: 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 < 7731e8dfbe4a56773be5dc94d631611211156659

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-41204 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's Grappler optimizer phase is responsible for optimizing the computational graph of a TensorFlow model. During this phase, constant folding is performed to simplify the graph by evaluating and folding constant operations. However, in affected versions of TensorFlow, constant folding may attempt to deep copy a resource tensor, which is not intended to change. This can lead to a segmentation fault (segfault) and potential crashes in the application. TensorFlow versions 2.4.4, 2.5.2, 2.6.1, and 2.7.0rc0 are affected by this vulnerability.

Vulnerability Detail

The vulnerability in TensorFlow's Grappler optimizer phase allows for a resource tensor to be deep copied, contrary to its intended behavior of not changing. This can result in a segfault, leading to crashes in the application. An attacker could potentially exploit this vulnerability to cause denial-of-service (DoS) attacks or execute arbitrary code. It is important to note that this vulnerability only affects certain versions of TensorFlow and can be mitigated by updating to the fixed 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"
  • >= 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 specific workaround provided for this vulnerability. The recommended approach is to update TensorFlow to the fixed versions as mentioned in the 'how_to_fix' section.

Conclusion

The vulnerability in TensorFlow's Grappler optimizer phase allows for a resource tensor to be deep copied, resulting in a segfault and potential crashes in the application. It is crucial to update TensorFlow to the fixed versions (2.7.0, 2.6.1, 2.5.2, or 2.4.4) to mitigate this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow-gpu →

Share this vulnerability

FAQ

TensorFlow is an open source platform for machine learning that provides tools and libraries for building and deploying machine learning models.

The Grappler optimizer phase in TensorFlow is responsible for optimizing the computational graph of a TensorFlow model. It performs various optimizations, including constant folding.

Constant folding is a process in TensorFlow where constant operations in the computational graph are evaluated and folded to simplify the graph.

A resource tensor in TensorFlow represents a tensor that holds state and is not intended to change. It is used for managing resources such as variables and queues.

This vulnerability can lead to crashes in the application due to segfaults. An attacker could potentially exploit this vulnerability to cause denial-of-service (DoS) attacks or execute arbitrary code.

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