CVE-2021-29588: Division by zero in TFLite's implementation of TransposeConv
Summary
CVE-2021-29588: Division by zero in TFLite's implementation of TransposeConv. 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-29588 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 developed by Google. It provides a comprehensive set of tools and libraries for building and deploying machine learning models. TensorFlow Lite (TFLite) is a lightweight version of TensorFlow designed for mobile and embedded devices. TFLite includes optimized operators for efficient execution on resource-constrained platforms. However, a vulnerability has been discovered in TFLite's implementation of the TransposeConv operator, which can lead to a division by zero error.
Vulnerability Detail
The optimized implementation of the TransposeConv operator in TFLite is vulnerable to a division by zero error. This vulnerability arises from the following code snippet:
int height_col = (height + pad_t + pad_b - filter_h) / stride_h + 1;
int width_col = (width + pad_l + pad_r - filter_w) / stride_w + 1;
If the stride_h or stride_w values are set to 0, a division by zero will occur. An attacker can exploit this vulnerability by crafting a malicious model that triggers this error. It is important for code calling this function to validate the arguments to prevent this vulnerability.
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.
Conclusion
The vulnerability in TFLite's implementation of the TransposeConv operator can lead to a division by zero error. This vulnerability has been patched in the latest versions of TensorFlow and users are advised to update their installations. 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 libraries for building and deploying machine learning models.
TensorFlow Lite (TFLite) is a lightweight version of TensorFlow designed for mobile and embedded devices. It includes optimized operators for efficient execution on resource-constrained platforms.
The TransposeConv operator is used in convolutional neural networks for performing transposed convolutions, also known as deconvolutions or upsampling.
An attacker can exploit this vulnerability by crafting a malicious model that triggers a division by zero error in the TransposeConv operator.
To protect your application, make sure to update your TensorFlow installation to the patched versions once they are released. Additionally, validate the arguments when calling the TransposeConv operator to prevent division by zero errors.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.