CVE-2022-41910: TensorFlow Heap Overflow in QuantizeAndDequantizeV2 Function
Summary
CVE-2022-41910: Heap overflow in QuantizeAndDequantizeV2. Affects tensorflow across 3 version ranges.
< 2.8.4
>= 2.9.0, < 2.9.3
>= 2.10.0, < 2.10.1
Fixed in 2.8.4, 2.9.3 or 2.10.1, depending on the release line you run. How to fix ↓
Also tracked for
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
- tensorflow · Bitnami
The same CVE-2022-41910 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 is an open-source machine learning framework that provides a comprehensive ecosystem for building and deploying machine learning models. It is widely used for tasks ranging from image recognition to natural language processing. The framework includes various functions for tensor operations, including quantization and dequantization, which are crucial for optimizing model performance. However, a vulnerability has been identified in the QuantizeAndDequantizeV2 function, which can lead to serious security issues if exploited.
Vulnerability Detail
The vulnerability arises from the MakeGrapplerFunctionItem function, which processes input and output sizes. If the input sizes are greater than or equal to the output sizes, it can trigger an out-of-bounds memory read or cause a crash. This heap overflow can potentially allow an attacker to execute arbitrary code or disrupt the application, leading to denial of service. The vulnerability is particularly concerning as it can be exploited through crafted input parameters, making it critical for users to address it promptly.
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.8.42.8.4pip install --upgrade "tensorflow==2.8.4" -
>= 2.9.0, < 2.9.32.9.3pip install --upgrade "tensorflow==2.9.3" -
>= 2.10.0, < 2.10.12.10.1pip install --upgrade "tensorflow==2.10.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, users should avoid using the QuantizeAndDequantizeV2 function with input sizes that could exceed output sizes. Here is an example of how to safely call the function:
import tensorflow as tf @tf.function
def safe_test():
tf.raw_ops.QuantizeAndDequantizeV2(input=[2.5],
input_min=[1.0],
input_max=[10.0],
signed_input=True,
num_bits=1,
range_given=True,
round_mode='HALF_TO_EVEN',
narrow_range=True,
axis=0)
safe_test()
Conclusion
The CVE-2022-41910 vulnerability in TensorFlow's QuantizeAndDequantizeV2 function poses a significant risk due to potential heap overflow issues. Users are strongly advised to update to the latest patched versions to mitigate this risk. Additionally, employing safe coding practices and utilizing tools like Vulert can help maintain application security.
See every vulnerability recorded for tensorflow →
FAQ
CVE-2022-41910 is a vulnerability in TensorFlow's QuantizeAndDequantizeV2 function that can lead to a heap overflow.
Exploiting this vulnerability can lead to out-of-bounds memory access, potentially allowing attackers to execute arbitrary code or crash the application.
Affected versions include TensorFlow versions prior to 2.8.4, 2.9.3, and 2.10.1.
You can update TensorFlow by running the command: 'pip install --upgrade tensorflow'.
Yes, you can use Vulert to monitor and alert for open-source vulnerabilities in your software without requiring access to the code. You can check your application using the Vulert playground at Vulert Scanner.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.