CVE-2021-37664: TensorFlow Heap Overflow in BoostedTreesSparseCalculateBestFeatureSplit
Summary
CVE-2021-37664: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu across 3 version ranges.
>= 2.3.0, < 2.3.4
>= 2.4.0, < 2.4.3
< e84c975313e8e8e38bb2ea118196369c45c51378
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 · PyPI
- tensorflow · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-37664 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 of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow is widely used in various domains, including research, industry, and academia. The package 'tensorflow-cpu' is a Python package that provides CPU-only support for TensorFlow. It allows users to leverage TensorFlow's capabilities on systems without GPU support.
Vulnerability Detail
The vulnerability identified as CVE-2021-37664 affects TensorFlow versions 2.3.0 and above. It resides in the 'BoostedTreesSparseCalculateBestFeatureSplit' function of the 'stats_ops.cc' file. By sending specially crafted illegal arguments, an attacker can read from outside the bounds of heap allocated data. The issue arises due to the lack of proper validation for each value in the 'stats_summary_indices' array, which should be within a valid range. This vulnerability can be exploited to leak sensitive information or potentially execute arbitrary code. The TensorFlow team has addressed this issue in GitHub commit e84c975313e8e8e38bb2ea118196369c45c51378, which will be included in TensorFlow 2.6.0. Additionally, the fix has been backported to TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, as these versions are also affected.
How To Fix
Latest published version: 2.21.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-cpu==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-cpu==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow-cpu==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 known workaround for this vulnerability. It is essential to apply the provided fix or update to the patched versions as soon as possible.
Conclusion
The vulnerability CVE-2021-37664 in TensorFlow's 'BoostedTreesSparseCalculateBestFeatureSplit' function can lead to heap overflow and potential information disclosure or arbitrary code execution. It is crucial to update to the patched versions or apply the provided fix to mitigate the risk. Regularly updating TensorFlow and its dependencies is recommended to stay protected against known vulnerabilities. For further support on vulnerability remediation, contact DevNack.com.
See every vulnerability recorded for tensorflow-cpu →
FAQ
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.
This vulnerability allows an attacker to read from outside the bounds of heap allocated data in TensorFlow. It can potentially lead to information disclosure or arbitrary code execution.
The vulnerability affects TensorFlow versions 2.3.0 and above. Specifically, TensorFlow 2.3.0, 2.4.0, 2.5.0, and their respective patch versions are affected.
Yes, the TensorFlow team has addressed this vulnerability in GitHub commit e84c975313e8e8e38bb2ea118196369c45c51378. The fix is included in TensorFlow 2.6.0 and has been backported to TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4.
To protect your TensorFlow installation, make sure to update to the patched versions (2.6.0, 2.5.1, 2.4.3, or 2.3.4). Regularly check for updates and apply them promptly to stay protected against known vulnerabilities.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.