CVE-2021-41201: TensorFlow GPU - Uninitialized Variable Access in EinsumHelper::ParseEquation()
Summary
CVE-2021-41201: 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
< f09caa532b6e1ac8d2aa61b7832c78c5b79300c6
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-41201 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 GPU is a specific package that enables GPU acceleration for TensorFlow. It allows users to leverage the power of GPUs to accelerate machine learning computations, resulting in faster training and inference times.
Vulnerability Detail
The vulnerability (CVE-2021-41201) exists in TensorFlow GPU versions prior to 2.7.0. During execution, the EinsumHelper::ParseEquation() function is responsible for setting flags in the input_has_ellipsis vector and *output_has_ellipsis boolean to indicate the presence of ellipsis in the corresponding inputs and output. However, the code only sets these flags to true and never assigns them false. This leads to uninitialized variable access if callers assume that EinsumHelper::ParseEquation() always sets these flags. An attacker could potentially exploit this vulnerability to access uninitialized memory, which may result in information disclosure or arbitrary code execution.
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
As a temporary workaround, users can avoid using the EinsumHelper::ParseEquation() function or modify their code to handle the uninitialized variable access appropriately. Here is an example of how the code can be modified to handle the issue:
# Original code
equation = EinsumHelper.ParseEquation()
# Modified code
equation = EinsumHelper.ParseEquation()
if equation.input_has_ellipsis is None:
equation.input_has_ellipsis = []
if equation.output_has_ellipsis is None:
equation.output_has_ellipsis = False
Conclusion
In conclusion, the vulnerability (CVE-2021-41201) in TensorFlow GPU versions prior to 2.7.0 allows for uninitialized variable access in the EinsumHelper::ParseEquation() function. This can potentially lead to information disclosure or arbitrary code execution. Users are strongly advised to update their TensorFlow GPU installations to the latest patched version as soon as it becomes available. For further support on vulnerability remediation, contact DevNack.com.
See every vulnerability recorded for tensorflow-gpu →
FAQ
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 GPU is a specific package that enables GPU acceleration for TensorFlow. It allows users to leverage the power of GPUs to accelerate machine learning computations.
The vulnerability could potentially allow an attacker to access uninitialized memory, leading to information disclosure or arbitrary code execution.
The vulnerability affects TensorFlow GPU versions prior to 2.7.0. Specifically, versions 2.4.4, 2.5.2, and 2.6.1 are also affected.
The vulnerability can be fixed by updating TensorFlow GPU to the latest patched version (2.7.0 or later) once it becomes available. Follow the official TensorFlow documentation for upgrading TensorFlow GPU.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.