CVE-2021-37690: TensorFlow CPU - ShapeAndType Struct Information Disclosure
Summary
CVE-2021-37690: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu across 3 version ranges.
>= 2.3.0, < 2.3.4
>= 2.4.0, < 2.4.3
< ee119d4a498979525046fba1c3dd3f13a039fbb1
Fixed in 2.3.4 or 2.4.3, depending 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-37690 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 end-to-end 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 that focuses on running TensorFlow on CPUs. It is widely used in various industries and research fields for machine learning tasks.
Vulnerability Detail
The vulnerability (CVE-2021-37690) in TensorFlow CPU arises when running shape functions, specifically in functions like MutableHashTableShape. These functions produce extra output information in the form of a ShapeAndType struct. However, the shapes embedded in this struct are owned by an inference context that is cleaned up almost immediately. If the upstream code attempts to access this shape information, it can trigger a segmentation fault (segfault). Although ShapeRefiner mitigates this issue for normal output shapes by cloning them, it fails to do the same for shapes and types. This vulnerability can be exploited by an attacker to cause a denial-of-service (DoS) condition or potentially execute arbitrary code.
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.3.0, < 2.3.42.3.4pip install --upgrade "tensorflow-cpu==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow-cpu==2.4.3"
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 recommended to apply the provided fix by updating their TensorFlow CPU package to the patched versions.
Conclusion
The vulnerability (CVE-2021-37690) in TensorFlow CPU allows for an information disclosure through the ShapeAndType struct. It has been addressed in TensorFlow 2.6.0 and backported to earlier versions. Users are advised to update their TensorFlow CPU package to the patched versions to mitigate the risk. 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 that allows running TensorFlow on CPUs, providing machine learning capabilities without the need for specialized hardware like GPUs.
This vulnerability can lead to a denial-of-service (DoS) condition or potential execution of arbitrary code if exploited by an attacker.
You can use Vulert's playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities without requiring access to the code or installation.
No specific workaround is mentioned for this vulnerability. It is recommended to update the TensorFlow CPU package to the patched versions.
You can find more information about this vulnerability in the TensorFlow CPU advisory on the PyPA Advisory Database (https://github.com/pypa/advisory-database/blob/main/vulns/tensorflow-cpu/PYSEC-2021-603.yaml).
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.