CVE-2021-29555: Division by 0 in TensorFlow FusedBatchNorm
Summary
CVE-2021-29555: Division by 0 in FusedBatchNorm. 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-29555 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 machine learning framework widely used for developing and training deep learning models. It provides a comprehensive set of tools and libraries for building and deploying machine learning applications. FusedBatchNorm is a TensorFlow operation used for normalizing and scaling input data in neural networks. It is commonly used in various deep learning architectures to improve model performance and convergence. However, a vulnerability has been identified in the FusedBatchNorm implementation that can lead to a division by zero error, causing a denial of service.
Vulnerability Detail
The vulnerability (CVE-2021-29555) arises due to a division operation performed in the FusedBatchNorm implementation. The division is based on the last dimension of the input tensor, which is controlled by the user. An attacker can exploit this vulnerability by providing a tensor with a zero value in the last dimension, triggering a division by zero error. This can result in a runtime error and cause a denial of service. The impact of this vulnerability is limited to the availability of the TensorFlow application and does not allow for arbitrary code execution or data compromise.
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 workaround, users can validate the input tensor dimensions before passing them to the FusedBatchNorm operation. By ensuring that the last dimension of the tensor is non-zero, the division by zero error can be avoided. Here is an example of how to perform this validation in Python:
import tensorflow as tf
x = tf.constant([], shape=[1, 1, 1, 0], dtype=tf.float32)
if x.shape[-1] != 0:
# Perform FusedBatchNorm operation
...
else:
# Handle the case where the last dimension is zero
...
Conclusion
The division by zero vulnerability in TensorFlow's FusedBatchNorm operation (CVE-2021-29555) can lead to a denial of service. It has been addressed by the TensorFlow team in the latest patched versions. Users are advised to upgrade their TensorFlow installation to one of the fixed versions to mitigate the vulnerability. For further support and assistance with 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 a comprehensive set of tools and libraries for building and deploying machine learning models.
FusedBatchNorm is a TensorFlow operation used for normalizing and scaling input data in neural networks. It is commonly used to improve model performance and convergence.
The vulnerability can cause a denial of service by triggering a division by zero error in the FusedBatchNorm operation. However, it does not allow for arbitrary code execution or data compromise.
To fix the vulnerability, users should upgrade their TensorFlow installation to one of the patched versions: TensorFlow 2.1.4, TensorFlow 2.2.3, TensorFlow 2.3.3, TensorFlow 2.4.2, or TensorFlow 2.5.0 (upcoming release).
Yes, users can validate the input tensor dimensions before passing them to the FusedBatchNorm operation. By ensuring that the last dimension of the tensor is non-zero, the division by zero error can be avoided.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.