CVE-2021-41224: TensorFlow - `SparseFillEmptyRows` heap OOB
Summary
CVE-2021-41224: SparseFillEmptyRows heap OOB. Affects tensorflow across 3 version ranges.
< 2.4.4
>= 2.5.0, < 2.5.2
>= 2.6.0, < 2.6.1
Fixed in 2.4.4, 2.5.2 or 2.6.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-41224 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 resources for building and deploying machine learning models. The SparseFillEmptyRows function in TensorFlow is used to fill empty rows in a sparse tensor. However, a vulnerability has been discovered in the implementation of this function, which can lead to a heap out-of-bounds (OOB) access.
Vulnerability Detail
The vulnerability in the SparseFillEmptyRows function occurs when the size of the indices parameter does not match the size of the values parameter. This can trigger a heap OOB access, potentially leading to memory corruption and arbitrary code execution. An attacker could exploit this vulnerability by providing malicious input that causes the size mismatch. The impact of this vulnerability is considered high, with a CVSS score of 7.1.
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.4.42.4.4pip install --upgrade "tensorflow==2.4.4" -
>= 2.5.0, < 2.5.22.5.2pip install --upgrade "tensorflow==2.5.2" -
>= 2.6.0, < 2.6.12.6.1pip install --upgrade "tensorflow==2.6.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 known workaround for this vulnerability. It is recommended to apply the provided patches or update to the latest version of TensorFlow to ensure the security of the application.
Conclusion
The vulnerability in the SparseFillEmptyRows function of TensorFlow can lead to a heap out-of-bounds (OOB) access, potentially resulting in memory corruption and arbitrary code execution. Users are advised to update their TensorFlow package to the latest patched version or upgrade to TensorFlow 2.7.0. 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 resources for building and deploying machine learning models.
SparseFillEmptyRows is a function in TensorFlow used to fill empty rows in a sparse tensor.
An attacker can exploit this vulnerability by providing malicious input that causes a size mismatch between the indices and values parameters of the SparseFillEmptyRows function.
The vulnerability can lead to a heap out-of-bounds (OOB) access, potentially resulting in memory corruption and arbitrary code execution.
To mitigate this vulnerability, it is recommended to update the TensorFlow package to the latest patched version (2.6.1, 2.5.2, or 2.4.4) or upgrade to TensorFlow 2.7.0.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.