CVE-2021-37672: TensorFlow SdcaOptimizerV2 Heap Overflow
Summary
CVE-2021-37672: 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
< a4e138660270e7599793fa438cd7b2fc2ce215a6
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-37672 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 vulnerability described here affects the TensorFlow package, specifically the tf.raw_ops.SdcaOptimizerV2 function.
Vulnerability Detail
The vulnerability (CVE-2021-37672) allows an attacker to read data from outside the bounds of heap-allocated memory by exploiting a flaw in the tf.raw_ops.SdcaOptimizerV2 function. By sending specially crafted illegal arguments, an attacker can bypass the length check for example_labels, leading to a heap overflow. This can result in information disclosure or potentially allow an attacker to execute arbitrary code. The vulnerability has been patched in the latest versions of TensorFlow.
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 recommended to update to the patched versions of TensorFlow as mentioned in the 'how_to_fix' section.
Conclusion
The vulnerability (CVE-2021-37672) in TensorFlow's tf.raw_ops.SdcaOptimizerV2 function allows an attacker to read data from outside the bounds of heap-allocated memory. It is crucial to update TensorFlow to version 2.6.0 or later, or apply the provided patch to mitigate the vulnerability. For further assistance or support in vulnerability remediation, please 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 resources for developing and deploying machine learning models.
The vulnerability allows an attacker to read data from outside the bounds of heap-allocated memory, potentially leading to information disclosure or arbitrary code execution.
To fix the vulnerability, update TensorFlow to version 2.6.0 or later. Alternatively, you can apply the patch by cherrypicking the commit a4e138660270e7599793fa438cd7b2fc2ce215a6 on earlier versions.
Yes, older versions of TensorFlow are also affected by this vulnerability. It is recommended to update to the patched versions mentioned in the 'how_to_fix' section.
No, there is no known workaround for this vulnerability. Updating to the patched versions is the recommended solution.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.