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

tensorflow-gpu Updated 02 Oct 2025

Summary

03/02/2022
Yes i
Unrated
Not published

CVE-2022-21729: Tensorflow is an Open Source Machine Learning Framework. Affects tensorflow-gpu across 3 version ranges.

< 2.5.3 >= 2.6.0, < 2.6.3 < 58b34c6c8250983948b5a781b426f6aa01fd47af

Fixed in 2.5.3 or 2.6.3, 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 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 machine learning framework widely used for developing and deploying machine learning models. It provides a comprehensive ecosystem for building and training neural networks. TensorFlow GPU is a variant of TensorFlow that leverages GPU acceleration for faster computation. It is commonly used in scenarios where large-scale data processing and complex model training are required. However, the TensorFlow GPU package is vulnerable to a division by zero issue, which can lead to unexpected behavior and potential security risks.

Vulnerability Detail

The vulnerability in TensorFlow GPU is caused by an integer overflow bug in the implementation of the UnravelIndex function. This bug can trigger a division by zero error, resulting in program crashes or incorrect calculations. An attacker could potentially exploit this vulnerability to cause denial of service or manipulate the results of machine learning models. The issue has been identified and fixed in TensorFlow 2.8.0, and the fix has also been backported to TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, which are still within the supported range.

How To Fix

Latest published version: 2.12.0 as of 22 Oct 2026

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

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 avoid using the UnravelIndex function in their code or implement additional input validation to prevent triggering the division by zero bug. Here is an example of input validation for the UnravelIndex function:

import tensorflow as tf

def safe_unravel_index(indices, shape):
    if any(i >= s for i, s in zip(indices, shape)):
        raise ValueError('Invalid indices')
    return tf.unravel_index(indices, shape)

Conclusion

The division by zero vulnerability in TensorFlow GPU can have serious consequences, including program crashes and incorrect calculations. It is crucial to update the affected versions to the fixed versions or apply the provided patches to ensure the security and reliability of machine learning models. For further assistance or support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow-gpu →

Share this vulnerability

FAQ

TensorFlow GPU is a variant of the TensorFlow machine learning framework that utilizes GPU acceleration for faster computation. It is commonly used in scenarios where large-scale data processing and complex model training are required.

The vulnerability in TensorFlow GPU can lead to division by zero errors, resulting in program crashes or incorrect calculations. An attacker could potentially exploit this vulnerability to cause denial of service or manipulate the results of machine learning models.

The vulnerability affects TensorFlow GPU versions 2.5.3, 2.6.3, and 2.7.1. These versions have been identified as vulnerable and should be updated to the fixed versions.

To fix the vulnerability, it is recommended to update the TensorFlow GPU package to version 2.8.0 or apply the respective patches for TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3. The updated versions include the necessary fixes to prevent the division by zero issue.

As a temporary workaround, users can avoid using the UnravelIndex function in their code or implement additional input validation to prevent triggering the division by zero bug.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow-gpu.

How To Fix

Latest published version: 2.12.0 as of 22 Oct 2026

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

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