CVE-2021-37689: Null Pointer Dereference in TensorFlow MLIR Optimizations
Summary
CVE-2021-37689: Null pointer dereference in TFLite MLIR optimizations. 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-37689 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 deploying machine learning models. It provides a comprehensive ecosystem of tools, libraries, and resources for building and training neural networks. TensorFlow supports various platforms and programming languages, making it a popular choice among developers and researchers. However, a vulnerability has been discovered in TensorFlow's MLIR optimizations, which could lead to a null pointer dereference and subsequent denial of service.
Vulnerability Detail
The vulnerability arises from the MLIR optimization of the L2NormalizeReduceAxis operator in TensorFlow. The implementation of this optimization unconditionally dereferences a pointer to an iterator without checking if the vector has any elements. As a result, an attacker can craft a TFLite model that triggers a null pointer dereference, causing the application to crash and resulting in a denial of service. The impact of this vulnerability can be severe, potentially disrupting critical machine learning processes and affecting the availability of TensorFlow-based applications.
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. The recommended approach is to update TensorFlow to the patched versions as mentioned in the 'how_to_fix' section.
Conclusion
The discovered vulnerability in TensorFlow's MLIR optimizations can lead to a null pointer dereference and denial of service. It is crucial to update your TensorFlow installation to the patched versions mentioned in the 'how_to_fix' section to mitigate the risk. Keeping your machine learning applications secure and up to date is essential. For further support and assistance in vulnerability remediation, you can reach out to DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
The vulnerability can be exploited by an attacker to craft a malicious TFLite model that triggers a null pointer dereference, leading to a crash and denial of service. This can disrupt machine learning processes and affect the availability of TensorFlow-based applications.
To fix this vulnerability, update your TensorFlow installation to the patched versions mentioned in the 'how_to_fix' section. If you are using TensorFlow 2.3.4, 2.4.3, or 2.5.1, you can also apply the fix by cherrypicking the mentioned commit.
No specific workarounds are provided for this vulnerability. Updating TensorFlow to the patched versions is the recommended approach.
The vulnerability affects TensorFlow versions 2.3.4, 2.4.3, and 2.5.0. These versions are still within the supported range and will receive the patched fix.
This vulnerability was reported by Yakun Zhang of Baidu Security.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.