CVE-2021-29586: Division by zero in optimized pooling implementations in TFLite
Summary
CVE-2021-29586: Division by zero in optimized pooling implementations in TFLite. Affects tensorflow across 4 version ranges.
< 2.1.4
>= 2.2.0, < 2.2.3
>= 2.3.0, < 2.3.3
>= 2.4.0, < 2.4.2
Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓
Also tracked for
- tensorflow · Bitnami
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-29586 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
The TensorFlow package is an open-source machine learning framework that provides a wide range of tools and libraries for building and deploying machine learning models. It is widely used in various applications, including image recognition, natural language processing, and recommendation systems. The vulnerability identified as CVE-2021-29586 affects the TensorFlow Lite (TFLite) component of the TensorFlow package. TFLite is a lightweight version of TensorFlow designed for mobile and embedded devices. It provides optimized implementations of common operations, such as pooling, to improve performance on resource-constrained devices.
Vulnerability Detail
The vulnerability in TFLite arises from a failure to check the stride arguments before calling the ComputePaddingHeightWidth function. This allows users to create models with zero stride values, leading to a division by zero error. An attacker can exploit this vulnerability by crafting a malicious model that triggers the division by zero error, potentially causing a denial of service or other unexpected behavior. The vulnerability has a CVSS score of 2.5, indicating a low 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.1.42.1.4pip install --upgrade "tensorflow==2.1.4" -
>= 2.2.0, < 2.2.32.2.3pip install --upgrade "tensorflow==2.2.3" -
>= 2.3.0, < 2.3.32.3.3pip install --upgrade "tensorflow==2.3.3" -
>= 2.4.0, < 2.4.22.4.2pip install --upgrade "tensorflow==2.4.2"
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 mentioned in the 'how_to_fix' section.
Conclusion
The vulnerability in the optimized pooling implementations in TFLite has been identified and patched in the TensorFlow package. Users are advised to update to the latest version or the patched versions based on their current version to mitigate the risk. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow Lite (TFLite) is a lightweight version of TensorFlow designed for mobile and embedded devices. It provides optimized implementations of common operations to improve performance on resource-constrained devices.
The vulnerability allows for a division by zero error in optimized pooling implementations in TFLite. This can be exploited by crafting malicious models, potentially leading to a denial of service or other unexpected behavior.
To fix this vulnerability, update to the latest version of TensorFlow (2.5.0) or the patched versions for earlier versions (2.1.4, 2.2.3, 2.3.3, and 2.4.2).
There is no specific workaround mentioned for this vulnerability. Updating to the patched versions is the recommended solution.
The vulnerability has a CVSS score of 2.5, indicating a low severity level.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.