CVE-2021-41225: TensorFlow GPU - Uninitialized Variable Use in Grappler Optimizer
Summary
CVE-2021-41225: 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
< 68867bf01239d9e1048f98cbad185bf4761bedd3
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-41225 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 open source platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow's Grappler optimizer is responsible for optimizing the computational graph of a TensorFlow model. It analyzes the graph and applies various optimizations to improve performance. However, a vulnerability has been discovered in the Grappler optimizer of TensorFlow GPU versions 2.4.4, 2.5.2, 2.6.1, and 2.7.0rc0, which allows for the use of uninitialized variables under certain conditions.
Vulnerability Detail
The vulnerability arises when the train_nodes vector obtained from the saved model being optimized does not contain a Dequeue node. In such cases, the dequeue_node variable is left uninitialized. This uninitialized variable can lead to unpredictable behavior and potential security risks. An attacker may be able to exploit this vulnerability to manipulate the optimizer's behavior or cause a denial of service.
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.42.4.4pip install --upgrade "tensorflow-gpu==2.4.4" -
>= 2.5.0, < 2.5.22.5.2pip install --upgrade "tensorflow-gpu==2.5.2" -
>= 2.6.0, < 2.6.12.6.1pip install --upgrade "tensorflow-gpu==2.6.1" -
>= 2.7.0rc0, < 2.7.02.7.0pip 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 mentioned for this vulnerability. Users are advised to upgrade to the fixed versions of TensorFlow GPU as soon as possible.
Conclusion
The vulnerability in TensorFlow GPU's Grappler optimizer can lead to uninitialized variable use, potentially resulting in unpredictable behavior and security risks. Users are advised to upgrade to the fixed versions (2.7.0, 2.6.1, 2.5.2, or 2.4.4) to mitigate the vulnerability. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-gpu →
FAQ
TensorFlow is an open source platform for machine learning that provides a comprehensive ecosystem of tools and resources for developing and deploying machine learning models.
The Grappler optimizer is a component of TensorFlow that analyzes the computational graph of a TensorFlow model and applies various optimizations to improve performance.
The vulnerability occurs when the train_nodes vector obtained from the saved model being optimized does not contain a Dequeue node, leading to the uninitialized dequeue_node variable.
The uninitialized variable can lead to unpredictable behavior and potential security risks. An attacker may be able to exploit this vulnerability to manipulate the optimizer's behavior or cause a denial of service.
To fix the vulnerability, users should upgrade their TensorFlow GPU installation to one of the fixed versions (2.7.0, 2.6.1, 2.5.2, or 2.4.4).
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.