CVE-2021-37688: Null Pointer Dereference in TensorFlow
Summary
CVE-2021-37688: Null pointer dereference in TFLite. 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-37688 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 could lead to a denial of service (DoS) attack.
Vulnerability Detail
The vulnerability, identified as CVE-2021-37688, is a null pointer dereference issue in TensorFlow's TFLite module. An attacker can exploit this vulnerability by crafting a malicious TFLite model that triggers the null pointer dereference. When the model is executed, it causes the TensorFlow interpreter to crash, resulting in a DoS condition. The vulnerable code unconditionally dereferences a pointer, leading to the crash. This vulnerability has a CVSS score of 7.8, indicating a high severity level.
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 temporary workaround, users can avoid the vulnerability by not executing untrusted TFLite models. It is recommended to only use TFLite models from trusted sources or verify the integrity of the models before execution. Here is an example of how to load and execute a TFLite model safely:
import tensorflow as tf
interpreter = tf.lite.Interpreter(model_path='trusted_model.tflite')
interpreter.allocate_tensors()
interpreter.invoke()
By using this approach, the null pointer dereference vulnerability can be avoided.
Conclusion
The null pointer dereference vulnerability in TensorFlow's TFLite module can be exploited to crash the TensorFlow interpreter, resulting in a denial of service (DoS) condition. To mitigate this vulnerability, users should update their TensorFlow installations to the patched versions. Additionally, it is advised to exercise caution when executing TFLite models from untrusted sources. For further assistance and support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
The vulnerability allows an attacker to crash the TensorFlow interpreter, leading to a denial of service (DoS) condition. This can disrupt the availability of TensorFlow-based applications and services.
You can use the Vulert Playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Simply provide your Pipfile.lock file, and Vulert will analyze it for open-source vulnerabilities, including CVE-2021-37688.
No, the vulnerability affects TensorFlow versions 2.3.4, 2.4.3, 2.5.0, and 2.5.1. The issue has been fixed in TensorFlow 2.6.0 and the aforementioned patched versions.
At the time of this advisory, there are no known public exploits targeting this vulnerability. However, it is important to apply the patches and take necessary precautions to prevent potential attacks.
While updating to the patched versions is the recommended solution, you can temporarily mitigate the vulnerability by avoiding the execution of untrusted TFLite models. Only use TFLite models from trusted sources or verify their integrity before execution.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.