CVE-2021-41227: TensorFlow ImmutableConst Operation Arbitrary Memory Read
Summary
CVE-2021-41227: TensorFlow is an open source platform for machine learning. Affects tensorflow-gpu across 6 version ranges.
< 1cb6bb6c2a6019417c9adaf9e6843ba75ee2580b
< 2.4.4
>= 2.5.0, < 2.5.2
>= 2.6.0, < 2.6.1
>= 2.7.0rc0, < 2.7.0
< 3712a2d3455e6ccb924daa5724a3652a86f6b585
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-41227 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 building and deploying machine learning models. TensorFlow supports various data types and operations for efficient computation. However, a vulnerability has been discovered in the ImmutableConst operation of TensorFlow, which can be exploited to read arbitrary memory contents. This vulnerability affects versions of TensorFlow up to 2.7.0 and poses a security risk to applications utilizing TensorFlow's machine learning capabilities.
Vulnerability Detail
The vulnerability arises from the tstring TensorFlow string class, which has a special case for memory mapped strings. However, the ImmutableConst operation does not properly handle this datatype, allowing an attacker to trick the operation into reading arbitrary memory contents. By exploiting this vulnerability, an attacker could potentially access sensitive information or execute arbitrary code within the context of the affected application. The TensorFlow development team has addressed this issue and provided fixes in TensorFlow versions 2.7.0, 2.6.1, 2.5.2, and 2.4.4.
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
There is no known workaround for this vulnerability. It is crucial to update TensorFlow to the patched versions mentioned above to mitigate the risk of exploitation.
Conclusion
The vulnerability in the ImmutableConst operation of TensorFlow can be exploited to read arbitrary memory contents, posing a security risk to applications utilizing TensorFlow's machine learning capabilities. It is essential to update TensorFlow to the latest patched version or apply the respective patches for older versions to mitigate this vulnerability. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-gpu →
FAQ
TensorFlow is an open source platform for machine learning that provides tools and libraries for building and deploying machine learning models.
The ImmutableConst operation in TensorFlow is responsible for creating a constant tensor that cannot be modified during execution.
The vulnerability arises from the mishandling of the tstring datatype within the ImmutableConst operation, allowing an attacker to read arbitrary memory contents.
Exploiting this vulnerability could lead to unauthorized access to sensitive information or the execution of arbitrary code within the affected application.
To protect your application, it is crucial to update TensorFlow to the latest patched version (2.7.0) or apply the respective patches for older versions (2.6.1, 2.5.2, or 2.4.4). This will ensure that the vulnerability is addressed and the ImmutableConst operation handles the tstring datatype correctly.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.