CVE-2022-21729: TensorFlow UnravelIndex Division by Zero Vulnerability

tensorflow Updated 18 Jul 2026

Summary

09/07/2026
Yes i
High
6.5

CVE-2022-21729: Overflow and uncaught divide 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-21729 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 Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

TensorFlow is an open-source machine learning library developed by Google, widely used for building and training machine learning models. It provides a comprehensive ecosystem for various tasks, including deep learning, neural networks, and data flow programming. However, TensorFlow has a vulnerability in its implementation of the UnravelIndex operation, which can lead to critical runtime errors.

Vulnerability Detail

The vulnerability arises from an integer overflow in the UnravelIndex implementation, which can lead to a division by zero error. This issue can be exploited by providing specific input values, such as negative indices or excessively large dimensions, resulting in undefined behavior or application crashes. This vulnerability poses a risk to applications relying on TensorFlow for machine learning tasks, potentially leading to data corruption or loss of service.

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

As a temporary workaround, avoid using negative indices or excessively large dimensions when calling the UnravelIndex operation. For example, instead of using: 'tf.raw_ops.UnravelIndex(indices=-0x100000, dims=[0x100000, 0x100000])', ensure that both indices and dimensions are within valid ranges.

Conclusion

The CVE-2022-21729 vulnerability in TensorFlow's UnravelIndex operation poses significant risks due to potential division by zero errors. It is crucial for users to update to the patched versions to mitigate these risks and ensure the stability and security of their applications.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

CVE-2022-21729 is a vulnerability in TensorFlow's UnravelIndex operation that can lead to a division by zero error due to integer overflow.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.

Exploiting this vulnerability can lead to application crashes, undefined behavior, and potential data corruption.

Affected versions include TensorFlow 2.5.3, 2.6.0, 2.7.0, and earlier versions. The vulnerability has been patched in versions 2.5.3, 2.6.3, 2.7.1, and 2.8.0.

For reporting new vulnerabilities, consult TensorFlow's security guide available at https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md.

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