CVE-2021-37659: Reference binding to nullptr and heap OOB in binary cwise ops in TensorFlow
Summary
CVE-2021-37659: Reference binding to nullptr and heap OOB in binary cwise ops. 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-37659 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 widely used for various applications. It provides a comprehensive ecosystem of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow supports numerical computations using data flow graphs and provides efficient implementations for various mathematical operations. However, a vulnerability has been discovered in TensorFlow that can lead to undefined behavior and potential security risks.
Vulnerability Detail
The vulnerability (CVE-2021-37659) in TensorFlow arises from a reference binding to a nullptr and heap out-of-bounds (OOB) access in binary cwise operations. When performing binary cwise operations, such as gradients of binary cwise operations, an attacker can trigger undefined behavior by binding a reference to a null pointer. The implementation assumes that the two inputs have the same number of elements but fails to check this condition. As a result, executing the eigen functor can lead to heap OOB reads and undefined behavior. This vulnerability has a CVSS score of 7.3, indicating a high severity level.
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
There is no specific workaround mentioned for this vulnerability. Users are advised to update to the patched versions of TensorFlow as soon as possible.
Conclusion
The vulnerability (CVE-2021-37659) in TensorFlow can lead to undefined behavior and potential security risks. It is crucial to update your 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) to mitigate the vulnerability. For further support on vulnerability remediation, you can contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open-source machine learning framework used for developing and deploying machine learning models.
The vulnerability can lead to undefined behavior and potential security risks when performing certain binary cwise operations in TensorFlow.
To fix the vulnerability, update your 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.
There is no specific workaround mentioned for this vulnerability. Updating to the patched versions of TensorFlow is the recommended solution.
For more information, please refer to the TensorFlow security guide and the GitHub advisory database.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.