CVE-2022-21726: Out of Bounds Read in TensorFlow
Summary
CVE-2022-21726: Out of bounds read 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
- tensorflow · Bitnami
- tensorflow-gpu · PyPI
- tensorflow-cpu · PyPI
The same CVE-2022-21726 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 developed by Google. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning models. TensorFlow is widely used in various industries and research fields for tasks such as image recognition, natural language processing, and recommendation systems. However, a vulnerability has been discovered in TensorFlow that could potentially lead to out-of-bounds read access, posing a security risk to applications utilizing this framework.
Vulnerability Detail
The vulnerability, identified as CVE-2022-21726, originates from an implementation flaw in the Dequantize function of TensorFlow. This function is responsible for converting quantized tensors to floating-point tensors. The issue arises from inadequate validation of the axis parameter, which specifies the axis along which the dequantization operation is performed. By providing a value outside the valid range, an attacker can trigger heap out-of-bounds accesses, potentially leading to information disclosure or arbitrary code execution. The vulnerability has a CVSS score of 8.1, indicating a high severity level.
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.32.5.3pip install --upgrade "tensorflow==2.5.3" -
>= 2.6.0, < 2.6.32.6.3pip install --upgrade "tensorflow==2.6.3" -
>= 2.7.0, < 2.7.12.7.1pip 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, users can avoid the vulnerability by ensuring that the axis parameter passed to the Dequantize function is within the valid range. The valid range for axis is from -1 (default value) to the number of dimensions of the input tensor. By verifying and limiting the axis value, the risk of triggering the out-of-bounds read can be mitigated. Here is an example of how to use a valid axis value:
import tensorflow as tf
@tf.function
def test():
y = tf.raw_ops.Dequantize(
input=tf.constant([1,1],dtype=tf.qint32),
min_range=[1.0],
max_range=[10.0],
mode='MIN_COMBINED',
narrow_range=False,
axis=-1,
dtype=tf.bfloat16)
return y
test()
Conclusion
In conclusion, the vulnerability (CVE-2022-21726) in TensorFlow poses a significant security risk due to its potential for out-of-bounds read access. Users are strongly advised to update their TensorFlow installation to one of the patched versions (2.5.3, 2.6.3, 2.7.1, or 2.8.0) to mitigate this vulnerability. Additionally, users can employ the provided workaround to limit the axis parameter and reduce the risk of exploitation. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open-source machine learning framework developed by Google. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning models.
The vulnerability in TensorFlow can result in out-of-bounds read access, which may lead to information disclosure or arbitrary code execution. It is important to update to the patched versions to mitigate this risk.
To fix the vulnerability, users should update their TensorFlow installation to one of the patched versions: TensorFlow 2.5.3, TensorFlow 2.6.3, TensorFlow 2.7.1, or TensorFlow 2.8.0 (upcoming release).
Yes, as a temporary workaround, users can ensure that the axis parameter passed to the Dequantize function is within the valid range. By limiting the axis value, the risk of triggering the out-of-bounds read can be mitigated.
For more information regarding the security model of TensorFlow and how to report issues, please consult the TensorFlow security guide available on the project's GitHub repository.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.