CVE-2021-29588: TensorFlow GPU - 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-gpu 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 · PyPI
- tensorflow · PyPI
- tensorflow-cpu · 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 open-source platform for machine learning that provides a comprehensive ecosystem for developing and deploying machine learning models. It offers a wide range of functionalities and optimized implementations for various operations. One of these operations is the TransposeConv TFLite operator, which is used for transposed convolutional operations in TensorFlow GPU. This operator allows for upsampling and deconvolution in neural networks. However, a vulnerability has been identified in the optimized implementation of this operator, which can lead to a division by zero error.
Vulnerability Detail
The vulnerability in the TransposeConv TFLite operator arises from a lack of validation for the stride_{h,w} values. An attacker can exploit this vulnerability by crafting a malicious model with stride_{h,w} values set to 0. When the vulnerable code is called with these arguments, a division by zero error occurs. This error can have various ramifications depending on the context in which the operator is used. It can lead to crashes, incorrect results, or even potential security breaches if the error is triggered in a security-sensitive part of the code.
How To Fix
Latest published version: 2.12.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-gpu==2.12.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-gpu==2.1.4" -
>= 2.2.0, < 2.2.32.2.3pip install --upgrade "tensorflow-gpu==2.2.3" -
>= 2.3.0, < 2.3.32.3.3pip install --upgrade "tensorflow-gpu==2.3.3" -
>= 2.4.0, < 2.4.22.4.2pip install --upgrade "tensorflow-gpu==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 workaround, users can manually validate the stride_{h,w} values before calling the TransposeConv TFLite operator. By ensuring that these values are not set to 0, the division by zero error can be avoided. Here is an example code snippet demonstrating the validation step:
if stride_h == 0 or stride_w == 0:
raise ValueError('Invalid stride values: stride_h and stride_w must be non-zero')
Conclusion
In conclusion, the TransposeConv TFLite operator in TensorFlow GPU is vulnerable to a division by zero error when the stride_{h,w} values are set to 0. This vulnerability can have various consequences and should be addressed by updating to the latest patched version of TensorFlow. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-gpu →
FAQ
TensorFlow is an open-source platform for machine learning that provides tools and libraries for developing and deploying machine learning models.
The TransposeConv TFLite operator is an optimized implementation in TensorFlow GPU that allows for transposed convolutional operations, enabling upsampling and deconvolution in neural networks.
The vulnerability arises from a lack of validation for the stride_{h,w} values. If these values are set to 0, a division by zero error occurs when the vulnerable code is called.
The consequences of this vulnerability can vary depending on the context. It can lead to crashes, incorrect results, or even potential security breaches if the error is triggered in a security-sensitive part of the code.
To fix this vulnerability, it is recommended to update TensorFlow to the latest patched version, which includes the necessary fixes for the TransposeConv TFLite operator.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.