CVE-2021-29522: TensorFlow Conv3DBackprop Operations Division by Zero Denial of Service
Summary
CVE-2021-29522: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu 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
< 311403edbc9816df80274bd1ea8b3c0c0f22c3fa
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-gpu · PyPI
The same CVE-2021-29522 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 resources for building and deploying machine learning models. TensorFlow includes various operations for convolutional neural networks, including the tf.raw_ops.Conv3DBackprop* operations. These operations are responsible for computing the gradients of the convolutional filters in a 3D convolutional layer. However, a vulnerability has been discovered in these operations that can lead to a denial of service attack.
Vulnerability Detail
The vulnerability (CVE-2021-29522) arises from a failure to validate the input tensors in the tf.raw_ops.Conv3DBackprop* operations. Specifically, the implementation does not check if the input tensors are empty, resulting in a division by zero error. This vulnerability can be exploited by an attacker who controls the input sizes, allowing them to trigger a denial of service attack by causing a division by zero error. The impact of this vulnerability can be severe, as it can lead to the unavailability of the TensorFlow system and any applications relying on it.
How To Fix
Latest published version: 2.21.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-cpu==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-cpu==2.1.4" -
>= 2.2.0, < 2.2.32.2.3pip install --upgrade "tensorflow-cpu==2.2.3" -
>= 2.3.0, < 2.3.32.3.3pip install --upgrade "tensorflow-cpu==2.3.3" -
>= 2.4.0, < 2.4.22.4.2pip install --upgrade "tensorflow-cpu==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 tensors before calling the tf.raw_ops.Conv3DBackprop* operations. This can be done by checking if the tensors are empty and avoiding the operation if they are. Here is an example of how to perform this validation in Python:
import tensorflow as tf
# Validate input tensors
if input_tensor1.size == 0 or input_tensor2.size == 0:
print('Input tensors are empty. Skipping Conv3DBackprop operation.')
# Handle empty tensors case
else:
# Perform Conv3DBackprop operation
output_tensor = tf.raw_ops.Conv3DBackprop*(input_tensor1, input_tensor2)
# Continue with further processing
Note that this workaround should only be used until the patched version of TensorFlow is available and installed.
Conclusion
The vulnerability (CVE-2021-29522) in the tf.raw_ops.Conv3DBackprop* operations of TensorFlow can lead to a denial of service attack by triggering a division by zero error. Users are advised to update their TensorFlow installations to the latest patched version as soon as it becomes available. In the meantime, a temporary workaround is available by manually validating the input tensors before calling the operations. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-cpu →
FAQ
TensorFlow is an open source platform for machine learning that provides a comprehensive ecosystem of tools and resources for building and deploying machine learning models.
The tf.raw_ops.Conv3DBackprop* operations in TensorFlow are responsible for computing the gradients of the convolutional filters in a 3D convolutional layer. These operations are used in the training process of convolutional neural networks.
The vulnerability occurs due to a failure to validate the input tensors in the tf.raw_ops.Conv3DBackprop* operations. This allows an attacker to control the input sizes and trigger a division by zero error, leading to a denial of service attack.
The impact of this vulnerability can be severe, as it can lead to a denial of service attack on the TensorFlow system and any applications relying on it. This can result in the unavailability of the system and disruption of machine learning processes.
To fix this vulnerability, users should update their TensorFlow installations to the latest patched version as soon as it becomes available. The fix will be included in TensorFlow 2.5.0 and backported to earlier versions.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.