CVE-2021-37666: Reference binding to nullptr in tensorflow
Summary
CVE-2021-37666: Reference binding to nullptr in RaggedTensorToVariant. Affects tensorflow across 3 version ranges.
< 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 · Bitnami
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-37666 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 machine learning framework developed by Google. It provides a comprehensive ecosystem of tools, libraries, and community resources for building and deploying machine learning models. TensorFlow supports various platforms and programming languages, making it widely used in both research and production environments. However, a vulnerability has been discovered in TensorFlow that allows an attacker to cause undefined behavior by binding a reference to a null pointer in the RaggedTensorToVariant function.
Vulnerability Detail
The RaggedTensorToVariant function in TensorFlow has an incomplete validation of the splits values, specifically when the argument is empty. This allows an attacker to pass an empty value for rt_nested_splits, leading to a reference binding to a null pointer. By exploiting this vulnerability, an attacker can cause undefined behavior, potentially resulting in a crash or arbitrary code execution. The impact of this vulnerability is rated as HIGH with a CVSS score of 7.8.
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.42.3.4pip install --upgrade "tensorflow==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow==2.4.3" -
>= 2.5.0, < 2.5.12.5.1pip install --upgrade "tensorflow==2.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, users can avoid passing an empty value for rt_nested_splits when calling the RaggedTensorToVariant function. Instead, provide valid splits values to ensure proper validation and avoid the reference binding to a null pointer. Here's an example of a valid usage:
import tensorflow as tf
tf.raw_ops.RaggedTensorToVariant(
rt_nested_splits=[[0, 2, 4], [0, 3, 6]],
rt_dense_values=[1, 2, 3, 4, 5, 6],
batched_input=True)
Conclusion
In conclusion, the vulnerability CVE-2021-37666 in TensorFlow allows an attacker to cause undefined behavior by binding a reference to a null pointer in the RaggedTensorToVariant function. This vulnerability has been patched in TensorFlow version 2.6.0. Users are advised to update their installations to the latest patched version to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open-source machine learning framework developed by Google. It provides tools and libraries for building and deploying machine learning models.
The vulnerability allows an attacker to cause undefined behavior in TensorFlow, potentially leading to a crash or arbitrary code execution.
To fix this vulnerability, update your TensorFlow installation to version 2.6.0 or later.
Yes, you can avoid the vulnerability by ensuring you provide valid splits values when calling the RaggedTensorToVariant function.
For more information about TensorFlow security, please consult the TensorFlow security guide.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.