CVE-2021-37639: Null Pointer Dereference and Heap OOB Read in TensorFlow
Summary
CVE-2021-37639: Null pointer dereference and heap OOB read in operations restoring tensors. Affects tensorflow across 3 version ranges.
< 2.3.4
>= 2.4.0, < 2.4.3
>= 2.5.0, < 2.5.1
Fixed in 2.3.4, 2.4.3 or 2.5.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-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 open-source machine learning framework developed by Google. 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. However, a vulnerability has been discovered in TensorFlow that can lead to null pointer dereference and heap out-of-bounds read.
Vulnerability Detail
The vulnerability in TensorFlow arises when restoring tensors via raw APIs. If the tensor name is not provided or if the provided tensor names are insufficient, TensorFlow can be tricked into dereferencing a null pointer or reading memory outside the bounds of heap allocated data. This can result in undefined behavior and potential security risks. Attackers can exploit this vulnerability to execute arbitrary code or access sensitive information.
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.42.3.4pip install --upgrade "tensorflow==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow==2.4.3" -
>= 2.5.0, < 2.5.12.5.1pip install --upgrade "tensorflow==2.5.1"
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
As a workaround, users can ensure that the tensor names provided for restoration are valid and sufficient. It is important to validate the tensor name list and ensure that it contains the necessary elements for successful restoration. Additionally, users can implement input validation and sanitization to prevent potential exploitation of this vulnerability.
Conclusion
The vulnerability in TensorFlow can lead to null pointer dereference and heap out-of-bounds read. It is crucial to update TensorFlow to the latest version or apply the provided patches to mitigate the risk. Implementing input validation and sanitization can also help prevent potential exploitation. 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 developed by Google. It provides tools and resources for building and deploying machine learning models.
This vulnerability can lead to null pointer dereference and heap out-of-bounds read, potentially allowing attackers to execute arbitrary code or access sensitive information.
To fix this vulnerability, update TensorFlow to version 2.6.0 or apply the respective patches for versions 2.5.1, 2.4.3, and 2.3.4.
As a workaround, users can ensure that the tensor names provided for restoration are valid and sufficient. Implementing input validation and sanitization can also help mitigate the risk.
This vulnerability was reported by members of the Aivul Team from Qihoo 360.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.