CVE-2022-21727: Integer Overflow Vulnerability in TensorFlow-GPU
Summary
CVE-2022-21727: Tensorflow is an Open Source Machine Learning Framework. Affects tensorflow-gpu across 3 version ranges.
< 2.5.3
>= 2.6.0, < 2.6.3
< b64638ec5ccaa77b7c1eb90958e3d85ce381f91b
Fixed in 2.5.3 or 2.6.3, depending on the release line you run. How to fix ↓
Also tracked for
- tensorflow · PyPI
- tensorflow · Bitnami
- tensorflow · PyPI
- tensorflow-cpu · PyPI
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.
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.
No signup required · Results in about 60 seconds
Background
TensorFlow-GPU is an open-source machine learning framework that provides a comprehensive ecosystem for developing and deploying machine learning models. It is widely used in various domains for tasks such as image recognition, natural language processing, and recommendation systems. TensorFlow-GPU leverages the power of GPUs to accelerate the training and inference processes, making it suitable for large-scale machine learning tasks. However, a vulnerability has been discovered in the implementation of shape inference for the Dequantize function in TensorFlow-GPU.
Vulnerability Detail
The vulnerability arises from an integer overflow weakness in the Dequantize function's shape inference implementation. The axis argument, which specifies the axis along which to dequantize the input, can be set to a positive value up to the number of dimensions of the input tensor. However, the upper bound is not properly checked, and an attacker can trigger an integer overflow by providing a large positive value for axis. This can lead to unexpected behavior, memory corruption, or even remote code execution. The issue affects versions of TensorFlow-GPU up to 2.5.3, 2.6.3, and 2.7.1.
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.32.5.3pip install --upgrade "tensorflow-gpu==2.5.3" -
>= 2.6.0, < 2.6.32.6.3pip 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 the vulnerability by explicitly setting the axis argument to a valid value within the range of the input tensor's dimensions. By carefully inspecting the input tensor's shape, users can determine the appropriate value for axis and pass it as an argument to the Dequantize function. Here is an example of how to use the workaround in Python:
import tensorflow as tf
# Assuming `input_tensor` is the input tensor to be dequantized
axis = 0 # Set the `axis` argument to a valid value
output_tensor = tf.dequantize(input_tensor, axis=axis)
By explicitly setting the axis argument, users can ensure that the vulnerability is not triggered.
Conclusion
In conclusion, TensorFlow-GPU versions up to 2.5.3, 2.6.3, and 2.7.1 are vulnerable to an integer overflow weakness in the Dequantize function's shape inference implementation. This vulnerability can be exploited by providing a large positive value for the axis argument, leading to unexpected behavior, memory corruption, or remote code execution. Users are advised to update their TensorFlow-GPU installation to one of the fixed versions (2.8.0, 2.7.1, 2.6.3, or 2.5.3) and always stay up to date with the latest stable releases to ensure the security of their machine learning models. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-gpu →
FAQ
TensorFlow-GPU is an open-source machine learning framework that leverages the power of GPUs to accelerate training and inference processes.
The Dequantize function in TensorFlow-GPU is used to convert quantized tensors to floating-point tensors.
The vulnerability occurs due to a lack of proper bounds checking on the axis argument, which can lead to an integer overflow.
The vulnerability can result in unexpected behavior, memory corruption, or even remote code execution.
To protect your installation, make sure to update TensorFlow-GPU to one of the fixed versions (2.8.0, 2.7.1, 2.6.3, or 2.5.3) using the pip install --upgrade tensorflow-gpu command.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.