CVE-2021-29555: Division by 0 in TensorFlow FusedBatchNorm

tensorflow Updated 02 Oct 2025

Summary

21/05/2021
Yes i
Low
2.5

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

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.

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

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.4 2.1.4
    pip install --upgrade "tensorflow==2.1.4"
  • >= 2.2.0, < 2.2.3 2.2.3
    pip install --upgrade "tensorflow==2.2.3"
  • >= 2.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip 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 →

Share this vulnerability

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.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

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.4 2.1.4
    pip install --upgrade "tensorflow==2.1.4"
  • >= 2.2.0, < 2.2.3 2.2.3
    pip install --upgrade "tensorflow==2.2.3"
  • >= 2.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip 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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback