CVE-2021-37690: TensorFlow ShapeAndType Struct Segfault Vulnerability
Summary
CVE-2021-37690: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow 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-cpu · 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 is widely used in various domains, including research, industry, and academia. It allows users to build and train machine learning models using high-level APIs and provides efficient execution on a variety of hardware platforms. However, a vulnerability has been discovered in TensorFlow that can lead to a segmentation fault (segfault) when certain shape functions are run.
Vulnerability Detail
The vulnerability in TensorFlow arises when running shape functions that produce extra output information in the form of a ShapeAndType struct. 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 segfault. The issue is mitigated for normal output shapes by cloning them, but the same logic was not applied to shapes and types. This vulnerability can potentially be exploited by an attacker to cause a denial of service (DoS) or execute arbitrary code on a vulnerable system.
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.3.0, < 2.3.42.3.4pip install --upgrade "tensorflow==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow==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 provided for this vulnerability. The recommended course of action is to apply the patch or update to the patched versions of TensorFlow as mentioned in the 'how_to_fix' section.
Conclusion
The TensorFlow ShapeAndType Struct Segfault vulnerability can lead to a segfault and potential exploitation on vulnerable systems. It is crucial to update TensorFlow to the patched versions or apply the provided fix to mitigate the vulnerability. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open source platform for machine learning that provides tools and resources for developing and deploying machine learning models.
The vulnerability can lead to a segmentation fault (segfault) and potentially be exploited to cause a denial of service (DoS) or execute arbitrary code on a vulnerable system.
The vulnerability affects TensorFlow versions 2.3.0 and later. Specifically, versions 2.3.0 to 2.3.3, 2.4.0 to 2.4.2, and 2.5.0 to 2.5.0 are affected.
Yes, the vulnerability has been fixed in TensorFlow commit ee119d4a498979525046fba1c3dd3f13a039fbb1. The fix is included in TensorFlow 2.6.0 and has also been backported to versions 2.5.1, 2.4.3, and 2.3.4.
To update TensorFlow, follow the official TensorFlow documentation for instructions on updating the package to the latest patched version.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.