CVE-2021-29588: TensorFlow - Division by Zero Error in TransposeConv TFLite Operator
Summary
CVE-2021-29588: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow across 5 version ranges.
< 2.1.4
>= 2.2.0, < 2.2.3
>= 2.3.0, < 2.3.3
>= 2.4.0, < 2.4.2
< 801c1c6be5324219689c98e1bd3e0ca365ee834d
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
TensorFlow is an end-to-end open source platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and community resources that enable researchers and developers to build and deploy machine learning models. TensorFlow includes a TFLite operator called TransposeConv which is used for transposed convolution operations. This operator is optimized for performance. However, a vulnerability has been discovered in the optimized implementation of the TransposeConv operator, which can lead to a division by zero error.
Vulnerability Detail
The vulnerability in the TransposeConv TFLite operator arises due to a lack of validation of the stride_{h,w} arguments. An attacker can craft a malicious model with stride_{h,w} values set to 0, triggering a division by zero error during the execution of the operator. This vulnerability can potentially be exploited to cause a denial of service (DoS) condition or other unexpected behavior in TensorFlow applications that utilize the TransposeConv operator. The vulnerability affects versions of TensorFlow ranging from 0 to 2.4.2.
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
As a temporary workaround, users can manually validate the stride_{h,w} arguments before calling the TransposeConv operator. By ensuring that the stride_{h,w} values are non-zero, the division by zero error can be avoided. Here is an example of how to validate the arguments in Python:
stride_h = ... # Get the stride_h value
stride_w = ... # Get the stride_w value
if stride_h == 0 or stride_w == 0:
# Handle the error condition
...
else:
# Call the TransposeConv operator with the validated arguments
...
Conclusion
The vulnerability in the optimized implementation of the TransposeConv TFLite operator in TensorFlow can be mitigated by updating to TensorFlow 2.5.0 or applying the relevant patch. Users can also manually validate the stride_{h,w} arguments as a temporary workaround. It is important to regularly update TensorFlow to benefit from security fixes and improvements. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open source platform for machine learning that provides a comprehensive ecosystem of tools and libraries for building and deploying machine learning models.
The TransposeConv TFLite operator is a component of TensorFlow Lite, which is a lightweight version of TensorFlow designed for mobile and embedded devices. It is used for transposed convolution operations in machine learning models.
The vulnerability can be exploited by an attacker to cause a division by zero error in TensorFlow applications that use the TransposeConv operator. This can lead to a denial of service (DoS) condition or other unexpected behavior.
The vulnerability affects versions of TensorFlow ranging from 0 to 2.4.2. TensorFlow 2.5.0 and later versions have been patched to address the vulnerability.
To fix the vulnerability, users should update their TensorFlow installation to version 2.5.0 or apply the appropriate patch for their specific version. Regularly updating TensorFlow to the latest stable release is recommended.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.