CVE-2022-21726: Out of bounds read in Tensorflow
Impact The implementation of Dequantize does not fully validate the value of axis and can result in heap OOB accesses:
python import tensorflow as tf
@tf.function def test(): y = tf.rawops.Dequantize( input=tf.constant([1,1],dtype=tf.qint32), minrange=[1.0], maxrange=[10.0], mode='MINCOMBINED', narrowrange=False, axis=231-1, dtype=tf.bfloat16) return y
test()
The axis argument can be -1 (the default value for the optional argument) or any other positive value at most the number of dimensions of the input. Unfortunately, the upper bound is not checked and this results in reading past the end of the array containing the dimensions of the input tensor: cc if (axis > -1) { numslices = input.dimsize(axis); } // ... int64t predim = 1, postdim = 1; for (int i = 0; i < axis; ++i) { predim = floatoutput.dimsize(i); } for (int i = axis + 1; i < floatoutput.dims(); ++i) { postdim = floatoutput.dimsize(i); } Patches We have patched the issue in GitHub commit 23968a8bf65b009120c43b5ebcceaf52dbc9e943. The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range. For more information Please consult our security guide for more information regarding the security model and how to contact us with issues and questions. Attribution This vulnerability has been reported by Yu Tian of Qihoo 360 AIVul Team.
Other sources
Tensorflow is an Open Source Machine Learning Framework. The implementation of Dequantize does not fully validate the value of axis and can result in heap OOB accesses. The axis argument can be -1 (the default value for the optional argument) or any other positive value at most the number of dimensions of the input. Unfortunately, the upper bound is not checked and this results in reading past the end of the array containing the dimensions of the input tensor. The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2022-21726?
CVE-2022-21726 is classified as a high severity vulnerability due to potential heap out-of-bounds (OOB) access.
How do I fix CVE-2022-21726?
To fix CVE-2022-21726, upgrade to TensorFlow version 2.7.1 or later, or 2.6.3 if using an earlier version.
What software is affected by CVE-2022-21726?
CVE-2022-21726 affects TensorFlow versions 2.5.3 and earlier, as well as 2.6.0 to 2.6.2, and version 2.7.0.
What type of vulnerability is CVE-2022-21726?
CVE-2022-21726 is a heap out-of-bounds access vulnerability that can lead to potential security risks.
Who is the vendor for CVE-2022-21726?
The vendor for CVE-2022-21726 is Google, as the vulnerability is associated with TensorFlow software.