CVE-2021-37637: Null Pointer Dereference in TensorFlow
Summary
CVE-2021-37637: Null pointer dereference in CompressElement. 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-37637 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 widely used for developing and training deep learning models. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning applications. TensorFlow supports various platforms and is available in different distributions, including PyPI. However, a vulnerability has been discovered in TensorFlow that could lead to a null pointer dereference.
Vulnerability Detail
The vulnerability, identified as CVE-2021-37637, allows an attacker to trigger a null pointer dereference in TensorFlow by passing an invalid input to the tf.raw_ops.CompressElement function. This vulnerability arises due to the implementation flaw in CompressElement, where the size of a buffer obtained from a separate function call is accessed before validating its validity. By exploiting this vulnerability, an attacker can cause the application to crash or potentially execute arbitrary code. The impact of this vulnerability is rated as HIGH with a CVSS score of 7.7.
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
There is no specific workaround provided for this vulnerability. However, users can mitigate the risk by ensuring they update to the patched versions of TensorFlow as mentioned in the 'how_to_fix' section.
Conclusion
In conclusion, the CVE-2021-37637 vulnerability in TensorFlow allows for a null pointer dereference, which can lead to application crashes or potential code execution. Users are advised to update their TensorFlow installation to one of the patched versions mentioned in the 'how_to_fix' section. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open-source machine learning framework used for developing and training deep learning models.
A null pointer dereference occurs when a program attempts to access or dereference a memory location that has a null (empty) value, resulting in a crash or potential code execution.
An attacker can exploit this vulnerability by passing an invalid input to the tf.raw_ops.CompressElement function in TensorFlow, triggering a null pointer dereference and potentially causing the application to crash or execute arbitrary code.
The impact of this vulnerability is rated as HIGH, with a CVSS score of 7.7. It can lead to application crashes or potential code execution, posing a significant risk to the integrity and availability of the affected system.
To fix this vulnerability, users should update their TensorFlow installation to one of the patched versions: TensorFlow 2.6.0, TensorFlow 2.5.1, TensorFlow 2.4.3, or TensorFlow 2.3.4. This can be done by upgrading the TensorFlow package using the package manager or manually installing the updated version from the official TensorFlow repository.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.