CVE-2021-37687: TensorFlow GPU - Arbitrary Data Read Vulnerability
Summary
CVE-2021-37687: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-gpu across 4 version ranges.
>= 2.3.0, < 2.3.4
>= 2.4.0, < 2.4.3
< bb6a0383ed553c286f87ca88c207f6774d5c4a8f
< eb921122119a6b6e470ee98b89e65d721663179d
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-cpu · PyPI
The same CVE-2021-37687 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 of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow GPU is a variant of TensorFlow that leverages the power of GPUs for accelerated computation. It is widely used in various industries and research domains for training and inference of deep learning models.
Vulnerability Detail
The vulnerability (CVE-2021-37687) exists in the TFLite module of TensorFlow GPU. The GatherNd and Gather implementations in TFLite's kernel do not support negative indices, but they lack proper checks for this situation. As a result, an attacker can exploit this flaw by crafting a malicious model with negative values in the indices parameter. By doing so, the attacker can read arbitrary data from the heap, potentially leading to information disclosure or further exploitation of the system. The issue has been addressed in the GitHub commits bb6a0383ed553c286f87ca88c207f6774d5c4a8f and eb921122119a6b6e470ee98b89e65d721663179d, and the fix will be included in TensorFlow 2.6.0. Additionally, the fix has been backported to TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, as these versions are also affected.
How To Fix
Latest published version: 2.12.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-gpu==2.12.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-gpu==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow-gpu==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
As a temporary workaround, you can avoid using negative indices in the indices parameter of the GatherNd and Gather operations in TFLite. By ensuring that only valid positive indices are used, you can reduce the risk of exploitation. Here's an example of how to modify the code to avoid negative indices:
# Original code
indices = [-1, 0, 1]
output = tf.gather_nd(data, indices)
# Modified code
indices = [0, 1, 2] # Use positive indices
output = tf.gather_nd(data, indices)
Conclusion
The vulnerability (CVE-2021-37687) in TensorFlow GPU's TFLite module exposes systems to arbitrary data read attacks. It is crucial to update to the patched versions (2.6.0, 2.5.1, 2.4.3, or 2.3.4) to mitigate the risk. By keeping your TensorFlow GPU installation up to date, you can ensure the security and integrity of your machine learning workflows. For further assistance or support in addressing this vulnerability, please contact DevNack.com.
See every vulnerability recorded for tensorflow-gpu →
FAQ
TensorFlow is an open source platform for machine learning that provides a comprehensive ecosystem of tools and resources for developing and deploying machine learning models.
TensorFlow GPU is a variant of TensorFlow that leverages the power of GPUs for accelerated computation. It is commonly used for training and inference of deep learning models.
TFLite is a module in TensorFlow that provides tools for deploying machine learning models on mobile and embedded devices.
The vulnerability arises from the lack of support for negative indices in the GatherNd and Gather operations. An attacker can exploit this by crafting a model with negative values in the indices parameter, allowing them to read arbitrary data from the heap.
The vulnerability can lead to information disclosure and potential further exploitation of the system. An attacker could read sensitive data from the heap, which may include credentials, private keys, or other confidential information.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.