CVE-2021-37641: TensorFlow - Out-of-Bounds Read in tf.raw_ops.RaggedGather
Summary
CVE-2021-37641: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow across 3 version ranges.
>= 2.3.0, < 2.3.4
>= 2.4.0, < 2.4.3
< a2b743f6017d7b97af1fe49087ae15f0ac634373
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-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-37641 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 platform for machine learning. It provides a comprehensive set of tools and libraries for building and deploying machine learning models. TensorFlow supports various operations and data structures, including ragged tensors. Ragged tensors are multi-dimensional tensors with variable-length dimensions. They are commonly used to represent nested data structures in machine learning applications.
Vulnerability Detail
The vulnerability (CVE-2021-37641) exists in TensorFlow versions 2.3.0 and above. It affects the tf.raw_ops.RaggedGather function, which is used for gathering values from a ragged tensor. The vulnerability arises when the arguments provided to the function do not determine a valid ragged tensor. This can lead to a read operation from outside the bounds of heap allocated buffers. The implementation of the function fails to check if the tensor has a rank of at least 1 (i.e., it is not a scalar) before reading its first dimension. Additionally, it does not verify that the list of tensors provided as params_nested_splits is not empty. An attacker can exploit this vulnerability to read sensitive data or cause a denial-of-service by crashing the application.
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.0, < 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"
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. Users are advised to update their TensorFlow installations to the latest patched version as mentioned in the 'how_to_fix' section.
Conclusion
The vulnerability (CVE-2021-37641) in TensorFlow's tf.raw_ops.RaggedGather function can lead to out-of-bounds reads and potential data exposure or application crashes. It is crucial to update TensorFlow installations to the latest patched version to mitigate this vulnerability. For further support on vulnerability remediation, contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open source platform for machine learning that provides tools and libraries for building and deploying machine learning models.
A ragged tensor is a multi-dimensional tensor with variable-length dimensions. It is commonly used to represent nested data structures in machine learning applications.
The vulnerability allows an attacker to read sensitive data or crash the application by triggering an out-of-bounds read operation.
To fix the vulnerability, update your TensorFlow installation to the latest patched version as mentioned in the 'how_to_fix' section.
No specific workaround is provided for this vulnerability. Updating to the patched version is the recommended solution.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.