CVE-2021-37639: TensorFlow - Null Pointer Dereference and Heap OOB Read Vulnerability
Summary
CVE-2021-37639: 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
< 9e82dce6e6bd1f36a57e08fa85af213e2b2f2622
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-37639 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 building and deploying machine learning models. TensorFlow is widely used in various domains, including research, industry, and academia. It allows users to define and execute computational graphs, making it efficient for large-scale machine learning tasks. However, a vulnerability has been discovered in TensorFlow that can lead to a null pointer dereference and heap out-of-bounds read.
Vulnerability Detail
The vulnerability in TensorFlow arises when restoring tensors via raw APIs without providing the tensor name. In such cases, TensorFlow can be tricked into dereferencing a null pointer. Additionally, if the tensor names provided are insufficient for a successful restoration, attackers can read memory outside the bounds of heap allocated data. The issue lies in the implementation of the tensor restoration process, where the tensor list corresponding to the user-controlled input tensor_name is retrieved. The tensor at the restoration index, controlled via the preferred_shard argument, is immediately retrieved without validating if the provided list has enough values. This can result in dereferencing a null pointer or heap out-of-bounds read, leading to undefined behavior and potential security risks.
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. Users are strongly recommended to update their TensorFlow installations to the patched versions as mentioned in the 'how_to_fix' section.
Conclusion
The vulnerability in TensorFlow that allows for null pointer dereference and heap out-of-bounds read has been addressed by the TensorFlow development team. Users are advised to update their TensorFlow installations to the patched versions mentioned in the 'how_to_fix' section. For further support on 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 building and deploying machine learning models.
This vulnerability can lead to a null pointer dereference or heap out-of-bounds read, potentially resulting in undefined behavior and security risks.
To fix this vulnerability, update your TensorFlow installation to the patched versions mentioned in the 'how_to_fix' section.
Yes, older versions of TensorFlow, specifically versions 2.3.0 to 2.3.4, 2.4.0 to 2.4.3, and 2.5.0 to 2.5.1, are affected by this vulnerability.
No specific workaround is provided for this vulnerability. Updating to the patched versions is the recommended solution.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.