CVE-2021-37637: TensorFlow Null Pointer Dereference in tf.raw_ops.CompressElement
Summary
CVE-2021-37637: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu across 3 version ranges.
>= 2.3.0, < 2.3.4
>= 2.4.0, < 2.4.3
< 5dc7f6981fdaf74c8c5be41f393df705841fb7c5
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 · PyPI
- tensorflow · 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 end-to-end open source platform for machine learning. It provides a comprehensive ecosystem for building and deploying machine learning models. TensorFlow includes various APIs and tools for data preprocessing, model training, and inference. The package is widely used in both research and production environments.
Vulnerability Detail
A null pointer dereference vulnerability exists in TensorFlow when an invalid input is passed to the tf.raw_ops.CompressElement function. The vulnerability arises due to the improper validation of a buffer obtained from a separate function call. By exploiting this vulnerability, an attacker can trigger a null pointer dereference, leading to a crash or potential code execution. The vulnerability affects versions 2.3.0 to 2.3.4, 2.4.0 to 2.4.3, and 2.5.0 to 2.5.1 of TensorFlow.
How To Fix
Latest published version: 2.21.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-cpu==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-cpu==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow-cpu==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 known workaround for this vulnerability. It is recommended to update to the patched version of TensorFlow as soon as possible.
Conclusion
The null pointer dereference vulnerability in TensorFlow can be mitigated by updating to the patched version or applying the provided patch manually. It is crucial to keep software dependencies up to date to ensure the security and stability of machine learning applications. For further support on vulnerability remediation, contact DevNack.com.
See every vulnerability recorded for tensorflow-cpu →
FAQ
TensorFlow is an open source platform for machine learning that provides a comprehensive ecosystem for building and deploying machine learning models.
A null pointer dereference occurs when a program attempts to access or manipulate memory using a null pointer, resulting in a crash or potential code execution.
The vulnerability can be exploited by passing an invalid input to the tf.raw_ops.CompressElement function in TensorFlow, triggering a null pointer dereference and potentially crashing the application or executing arbitrary code.
The vulnerability affects versions 2.3.0 to 2.3.4, 2.4.0 to 2.4.3, and 2.5.0 to 2.5.1 of TensorFlow.
To fix the vulnerability, update TensorFlow to version 2.6.0 or later. Alternatively, you can manually apply the patch by cherry-picking the commit onto TensorFlow 2.5.1, TensorFlow 2.4.3, or TensorFlow 2.3.4.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.