CVE-2021-41206: Incomplete validation of shapes in TensorFlow
Summary
CVE-2021-41206: Incomplete validation of shapes in multiple TF ops. Affects tensorflow across 3 version ranges.
< 2.4.4
>= 2.5.0, < 2.5.2
>= 2.6.0, < 2.6.1
Fixed in 2.4.4, 2.5.2 or 2.6.1, depending on the release line you run. How to fix ↓
Also tracked for
- tensorflow · Bitnami
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-41206 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 machine learning framework that provides a comprehensive ecosystem of tools, libraries, and resources for developing and deploying machine learning models. It is widely used in various domains, including research, industry, and academia. TensorFlow allows users to build and train neural networks, perform numerical computations, and process large datasets efficiently. However, a vulnerability has been discovered in TensorFlow that can lead to undefined behavior, crashes, and potential heap-based memory corruption.
Vulnerability Detail
The vulnerability in TensorFlow arises from incomplete validation of shapes in multiple TensorFlow operations. Certain operations fail to properly validate the shapes of tensor arguments, which can result in various issues. Depending on the specific API usage, these issues can lead to crashes, heap corruption, and even unauthorized reads and writes to memory. The vulnerability was discovered internally while working on improving GPU op determinism, and multiple fixes have been implemented to address the issue.
How To Fix
Latest published version: 2.21.0 as of 22 Oct 2026
pip install --upgrade "tensorflow==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==2.4.4" -
>= 2.5.0, < 2.5.22.5.2pip install --upgrade "tensorflow==2.5.2" -
>= 2.6.0, < 2.6.12.6.1pip install --upgrade "tensorflow==2.6.1"
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. It is recommended to update TensorFlow to the latest version or apply the available patches to mitigate the risk.
Conclusion
In conclusion, the vulnerability in TensorFlow related to incomplete validation of shapes in multiple TensorFlow operations can lead to crashes, undefined behavior, and potential memory corruption. It is crucial to update TensorFlow to the latest version or apply the available patches to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open-source machine learning framework used for building and training neural networks, performing numerical computations, and processing large datasets.
The vulnerability can result in crashes, undefined behavior, and potential heap-based memory corruption. It may also allow unauthorized reads and writes to memory.
The vulnerability was discovered internally while working on improving GPU op determinism.
There are no known exploits for this vulnerability at the time of this advisory.
To fix this vulnerability, update TensorFlow to version 2.7.0 or apply the relevant patches.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.