CVE-2021-29532: TensorFlow - Out-of-Bounds Read in RaggedCross
Summary
CVE-2021-29532: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow across 5 version ranges.
>= 2.2.0, < 2.3.0rc0
< 2.2.0rc0
>= 2.3.0, < 2.3.4
>= 2.4.0, < 2.4.3
< 44b7f486c0143f68b56c34e2d01e146ee445134a
Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓
Also tracked for
- tensorflow · Bitnami
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-29532 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 that provides a comprehensive set of tools and libraries for developing and deploying machine learning models. It is widely used in various domains for tasks such as image recognition, natural language processing, and recommendation systems. TensorFlow allows users to create and manipulate tensors, which are multi-dimensional arrays, to perform computations efficiently. However, a vulnerability has been discovered in TensorFlow that can lead to out-of-bounds reads in the RaggedCross operation.
Vulnerability Detail
The vulnerability (CVE-2021-29532) in TensorFlow arises from a lack of validation for user-supplied arguments in the RaggedCross operation. This operation is used to perform a cross join on ragged tensors, which are tensors with non-uniform shapes. By passing invalid tensor values to the RaggedCross operation, an attacker can force accesses outside the bounds of heap-allocated arrays. The implementation of the operation does not validate the indices used to access array elements, resulting in out-of-bounds reads. This vulnerability can be exploited to read sensitive data from the heap or cause a denial-of-service condition. The issue has been addressed in TensorFlow 2.5.0, and fixes have also been backported to earlier versions.
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.2.0rc02.2.0rc0pip install --upgrade "tensorflow==2.2.0rc0" -
>= 2.2.0, < 2.3.0rc02.3.0rc0pip install --upgrade "tensorflow==2.3.0rc0" -
>= 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
As a workaround, you can avoid using the RaggedCross operation if it is not essential for your machine learning tasks. If possible, you can modify your code to use alternative operations or approaches that do not rely on RaggedCross. By avoiding the vulnerable operation, you can mitigate the risk of exploitation.
Conclusion
The vulnerability (CVE-2021-29532) in TensorFlow's RaggedCross operation can lead to out-of-bounds reads, potentially exposing sensitive data or causing a denial-of-service condition. It is crucial to update TensorFlow to version 2.5.0 or later, or apply the relevant patches if using an earlier version. By keeping your TensorFlow installation up to date, you can ensure the security and stability of your machine learning applications. For further support on vulnerability remediation, please 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 developing and deploying machine learning models.
The RaggedCross operation in TensorFlow is used to perform a cross join on ragged tensors, which are tensors with non-uniform shapes.
An out-of-bounds read vulnerability occurs when a program accesses memory outside the bounds of an allocated array. This can lead to reading sensitive data or causing a crash.
The vulnerability in TensorFlow can be exploited to read sensitive data from the heap or cause a denial-of-service condition.
To protect your TensorFlow installation, it is recommended to update to the latest version or apply the relevant patches provided by the TensorFlow team.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.