CVE-2021-37656: TensorFlow - Reference Binding to Null Pointer in tf.raw_ops.RaggedTensorToSparse
Summary
CVE-2021-37656: 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
< 1071f554dbd09f7e101324d366eec5f4fe5a3ece
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-37656 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 set of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow is widely used in various industries and research domains.
Vulnerability Detail
In affected versions of TensorFlow, an attacker can exploit a vulnerability in the tf.raw_ops.RaggedTensorToSparse function. By binding a reference to a null pointer, the attacker can cause undefined behavior. The implementation of the function lacks proper validation of the splits values, specifically the check for increasing order. This oversight allows an attacker to manipulate the splits values and trigger unexpected behavior in the system. The vulnerability can potentially lead to crashes, data corruption, or even remote code execution.
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
As a temporary workaround, users can avoid using the tf.raw_ops.RaggedTensorToSparse function or ensure that the splits values passed to the function are in increasing order. By validating the splits values externally before invoking the function, users can mitigate the risk of exploitation. Here's an example of how to validate the splits values in Python:
splits = [1, 3, 2, 4]
if sorted(splits) == splits:
# Invoke tf.raw_ops.RaggedTensorToSparse
else:
# Handle invalid splits values
Conclusion
In conclusion, the vulnerability in TensorFlow allows an attacker to exploit the tf.raw_ops.RaggedTensorToSparse function by binding a reference to a null pointer. This can result in undefined behavior and potential security risks. It is crucial for users to update their TensorFlow installation to one of the patched versions and follow best practices for secure machine learning model development. For further support and assistance 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 set of tools and resources for developing and deploying machine learning models.
The vulnerability allows an attacker to cause undefined behavior in TensorFlow by binding a reference to a null pointer. This can lead to crashes, data corruption, or even remote code execution.
The vulnerability affects TensorFlow versions 2.3.0 and above. Specifically, TensorFlow 2.3.0 to 2.3.4, TensorFlow 2.4.0 to 2.4.3, TensorFlow 2.5.0 to 2.5.1, and TensorFlow 2.6.0 are affected.
To fix the vulnerability, users should update their TensorFlow installation to one of the patched versions: TensorFlow 2.6.0, TensorFlow 2.5.1, TensorFlow 2.4.3, or TensorFlow 2.3.4.
Yes, as a temporary workaround, users can avoid using the tf.raw_ops.RaggedTensorToSparse function or ensure that the splits values passed to the function are in increasing order.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.