CVE-2021-29580: TensorFlow - FractionalMaxPoolGrad Denial of Service Vulnerability
Summary
CVE-2021-29580: 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
< 32fdcbff9d06d010d908fcc4bd4b36eb3ce15925
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-29580 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 set of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow is widely used in various industries and research domains.
Vulnerability Detail
The vulnerability (CVE-2021-29580) in TensorFlow is related to the implementation of tf.raw_ops.FractionalMaxPoolGrad. When one of the input tensors is empty, it triggers an undefined behavior. Additionally, the code is susceptible to a denial of service attack due to a CHECK condition that becomes false and aborts the process. The vulnerability arises from the lack of validation for empty input and output tensors, as well as the assumption that they are of the same rank. This vulnerability can lead to unexpected program behavior and potential denial of service attacks.
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 input and output tensors before invoking tf.raw_ops.FractionalMaxPoolGrad. This can be done by checking if the tensors are empty and ensuring they have the same rank. Here is an example of how to perform the validation in Python:
import tensorflow as tf
def fractional_max_pool_grad(input, grad, pool_ratio, pseudo_random, overlapping):
if input.size == 0 or grad.size == 0 or input.ndim != grad.ndim:
raise ValueError('Invalid input or grad tensors')
# Rest of the code
Conclusion
The vulnerability in TensorFlow's tf.raw_ops.FractionalMaxPoolGrad can lead to undefined behavior and denial of service attacks. It is crucial for users to update their TensorFlow installations to version 2.5.0 once it is released. In the meantime, the provided workaround can be used to mitigate the vulnerability. For further support and assistance in 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 set of tools and resources for developing and deploying machine learning models.
The vulnerability in TensorFlow can lead to undefined behavior and potential denial of service attacks. It can cause unexpected program behavior and may result in the termination of the process.
The vulnerability affects TensorFlow versions 2.1.4 and above. Specifically, versions 2.1.4, 2.2.3, 2.3.3, and 2.4.2 are confirmed to be affected.
To fix this vulnerability, users should update their TensorFlow installations to version 2.5.0 once it becomes available. Regularly checking for updates and applying them promptly is recommended.
Yes, as a temporary workaround, users can manually validate the input and output tensors before invoking the vulnerable code. The provided workaround code snippet demonstrates how to perform the validation.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.