CVE-2022-21727: TensorFlow Integer Overflow Vulnerability in Dequantize Operation

tensorflow Updated 18 Jul 2026

Summary

09/07/2026
Yes i
High
7.6

CVE-2022-21727: Integer overflow 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-21727 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 library widely used for building and training neural networks. It provides a flexible ecosystem for developing machine learning models, including tools for deep learning, data processing, and deployment. However, TensorFlow has a vulnerability in its shape inference implementation for the Dequantize operation, which can lead to integer overflow issues, potentially affecting the stability and security of applications using this library.

Vulnerability Detail

The vulnerability arises from the lack of upper bound checks on the 'axis' argument in the Dequantize operation. When an attacker provides an excessively large value for 'axis', it can trigger an integer overflow during the computation of 'axis + 1'. This can lead to unexpected behavior, crashes, or even arbitrary code execution, compromising the integrity and availability of the application. The vulnerability is particularly concerning because it can be exploited by manipulating input values, making it a significant risk for applications relying on TensorFlow for machine learning tasks.

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 the Dequantize operation with an 'axis' value that could lead to overflow. Ensure that the 'axis' argument is set to a valid range, specifically between -1 and the number of dimensions of the input tensor. Here is an example of how to safely use the Dequantize operation:

import tensorflow as tf

input = tf.constant([1, 1], dtype=tf.qint32)

@tf.function

def safe_dequantize():
y = tf.raw_ops.Dequantize(
    input=input,
    min_range=[1.0],
    max_range=[10.0],
    mode='MIN_COMBINED',
    narrow_range=False,
    axis=0,  # Ensure this is within the valid range
    dtype=tf.bfloat16)
return y

safe_dequantize()

Conclusion

In summary, CVE-2022-21727 is a critical vulnerability in TensorFlow that can lead to integer overflow issues in the Dequantize operation. Users are advised to update to the latest patched versions to mitigate risks. For those unable to update immediately, implementing safe coding practices can help reduce exposure to this vulnerability.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

CVE-2022-21727 is a vulnerability in TensorFlow related to integer overflow in the Dequantize operation, which can lead to unexpected behavior or crashes.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit the Vulert playground at Vulert Scanner to check if your application is affected without any signup.

The affected versions of TensorFlow are all versions prior to 2.5.3, 2.6.3, and 2.7.1. It is recommended to update to one of these patched versions.

As a temporary measure, avoid using the Dequantize operation with potentially unsafe 'axis' values, ensuring they are within the valid range.

The CVSS score of this vulnerability is 7.6, indicating a high severity level that requires prompt attention.

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