CVE-2021-37687: TensorFlow - Arbitrary Data Read Vulnerability
Summary
CVE-2021-37687: Heap OOB in TensorFlow Lite's Gather* implementations. Affects tensorflow across 3 version ranges.
>= 2.3.0, < 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 · PyPI
- tensorflow · PyPI
- tensorflow-cpu · PyPI
- tensorflow-gpu · 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 for developing and deploying machine learning models. TensorFlow Lite (TFLite) is a lightweight version of TensorFlow designed for mobile and embedded devices. TFLite includes various kernel implementations for optimized performance. However, in affected versions, TFLite's GatherNd and Gather implementations have a vulnerability that allows an attacker to read arbitrary data from the heap.
Vulnerability Detail
The vulnerability arises from the lack of support for negative indices in the GatherNd and Gather implementations of TFLite. The absence of proper checks for negative indices allows an attacker to carefully craft a model with negative values in indices, leading to the ability to read arbitrary data from the heap. This can potentially expose sensitive information and compromise the integrity of the system. The issue has been patched in the GitHub commits bb6a0383ed553c286f87ca88c207f6774d5c4a8f and eb921122119a6b6e470ee98b89e65d721663179d, and the fix will be included in TensorFlow 2.6.0. The patch will also be backported to TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, as these versions are also affected.
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
>= 2.3.0, < 2.3.42.3.4 -
>= 2.4.0, < 2.4.32.4.3 -
>= 2.5.0, < 2.5.12.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 workaround, if updating TensorFlow is not immediately feasible, it is advised to exercise caution when processing models with negative indices. Ensure that the indices used in the GatherNd and Gather operations do not contain negative values.
Conclusion
The vulnerability in TensorFlow's TFLite GatherNd and Gather implementations allows an attacker to read arbitrary data from the heap. It is crucial to update to the latest version of TensorFlow or apply the provided patches to mitigate the risk. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open source platform for machine learning that provides a comprehensive ecosystem for developing and deploying machine learning models.
TensorFlow Lite (TFLite) is a lightweight version of TensorFlow designed for mobile and embedded devices.
The vulnerability allows an attacker to read arbitrary data from the heap, potentially exposing sensitive information and compromising system integrity.
To fix the vulnerability, update TensorFlow to version 2.6.0 or apply the respective patches for versions 2.5.1, 2.4.3, and 2.3.4.
As a workaround, exercise caution when processing models with negative indices and ensure that the indices used in the GatherNd and Gather operations do not contain negative values.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.