CVE-2021-41201: TensorFlow CPU - Uninitialized Variable Access in EinsumHelper::ParseEquation()
Summary
CVE-2021-41201: TensorFlow is an open source platform for machine learning. Affects tensorflow-cpu 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-gpu · 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 CPU is a specific package within TensorFlow that focuses on running TensorFlow computations on CPUs. It is widely used in various industries and research fields for machine learning tasks.
Vulnerability Detail
The vulnerability (CVE-2021-41201) exists in TensorFlow CPU 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. The impact of this vulnerability can vary depending on how the uninitialized variables are used by the callers, but it can potentially result in unexpected behavior, crashes, or even security vulnerabilities.
How To Fix
Latest published version: 2.21.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-cpu==2.21.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-cpu==2.4.4" -
>= 2.5.0, < 2.5.22.5.2pip install --upgrade "tensorflow-cpu==2.5.2" -
>= 2.6.0, < 2.6.12.6.1pip install --upgrade "tensorflow-cpu==2.6.1" -
>= 2.7.0rc0, < 2.7.02.7.0pip install --upgrade "tensorflow-cpu==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. The recommended approach is to upgrade to the fixed version of TensorFlow CPU.
Conclusion
The vulnerability (CVE-2021-41201) in TensorFlow CPU versions prior to 2.7.0 can lead to uninitialized variable access, potentially resulting in unexpected behavior, crashes, or security vulnerabilities. It is crucial to upgrade to the fixed version of TensorFlow CPU (2.7.0 or later) or apply the backported fixes in versions 2.4.4, 2.5.2, or 2.6.1. For further support on vulnerability remediation, you can reach out to DevNack.com.
See every vulnerability recorded for tensorflow-cpu →
FAQ
TensorFlow CPU is a package within TensorFlow that allows running TensorFlow computations on CPUs. It is designed for systems without GPU support or for scenarios where GPU acceleration is not required.
The impact of this vulnerability can vary depending on how the uninitialized variables are used by the callers. It can lead to unexpected behavior, crashes, or even security vulnerabilities.
The vulnerability affects TensorFlow CPU versions prior to 2.7.0. Specifically, versions 2.4.4, 2.5.2, and 2.6.1 are also affected and have been patched.
To fix this vulnerability, it is recommended to upgrade your TensorFlow CPU package to version 2.7.0 or later. Alternatively, you can also update to the backported fixes in versions 2.4.4, 2.5.2, or 2.6.1.
There is no specific workaround mentioned for this vulnerability. The recommended approach is to upgrade to the fixed version of TensorFlow CPU.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.