CVE-2022-21735: TensorFlow Division by Zero Vulnerability

tensorflow Updated 18 Jul 2026

Summary

09/07/2026
Yes i
High
6.5

CVE-2022-21735: Division by zero in Tensorflow. Affects tensorflow across 3 version ranges.

< 2.5.3 >= 2.6.0, < 2.6.3 >= 2.7.0, < 2.7.1

Fixed in 2.5.3, 2.6.3 or 2.7.1, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2022-21735 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

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

TensorFlow is an open-source library widely used for machine learning and deep learning applications. It provides a flexible ecosystem for building and deploying machine learning models. However, like any software, TensorFlow is not immune to vulnerabilities, which can lead to unexpected behaviors or crashes in applications that rely on it.

Vulnerability Detail

The vulnerability arises from the implementation of the FractionalMaxPool operation in TensorFlow, which can lead to a division by zero error. This issue can cause a TensorFlow process to crash, potentially disrupting applications that depend on its functionality. The vulnerability is triggered when specific parameters are passed to the FractionalMaxPool operation, particularly when the pooling ratio is set in a way that results in a division by zero.

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.5.3 2.5.3
    pip install --upgrade "tensorflow==2.5.3"
  • >= 2.6.0, < 2.6.3 2.6.3
    pip install --upgrade "tensorflow==2.6.3"
  • >= 2.7.0, < 2.7.1 2.7.1
    pip install --upgrade "tensorflow==2.7.1"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

If you cannot update TensorFlow immediately, you can avoid triggering the vulnerability by ensuring that the pooling ratio passed to the FractionalMaxPool operation does not lead to a division by zero. For example, avoid using pooling ratios that are too high or improperly configured. Here is an example of how to call the operation safely:

import tensorflow as tf import numpy as np

Ensure pooling_ratio is configured correctly

pooling_ratio = [1.0, 1.0, 1.0, 1.0] # Adjusted to avoid division by zero

result = tf.raw_ops.FractionalMaxPool( value=tf.constant(value=[[[[1, 4, 2, 3]]]], dtype=tf.int64), pooling_ratio=pooling_ratio, pseudo_random=False, overlapping=False, deterministic=False, seed=0, seed2=0, name=None

)

Conclusion

The CVE-2022-21735 vulnerability in TensorFlow poses a risk of crashing applications due to a division by zero error in the FractionalMaxPool operation. It is crucial to update to the patched versions or implement workarounds to mitigate this risk. Regular monitoring using tools like Vulert can help maintain the security of your applications.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

CVE-2022-21735 is a vulnerability in TensorFlow that can lead to a division by zero error, causing a crash in TensorFlow processes.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Check your application against the vulnerability using the Vulert playground.

The vulnerability affects TensorFlow versions prior to 2.5.3, 2.6.3, and 2.7.1.

You can implement workarounds by ensuring that the pooling ratio in the FractionalMaxPool operation does not lead to a division by zero.

The CVSS score for this vulnerability is 6.5, indicating a moderate severity level.

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.5.3 2.5.3
    pip install --upgrade "tensorflow==2.5.3"
  • >= 2.6.0, < 2.6.3 2.6.3
    pip install --upgrade "tensorflow==2.6.3"
  • >= 2.7.0, < 2.7.1 2.7.1
    pip install --upgrade "tensorflow==2.7.1"

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