Headline
CVE-2023-25659: Add out of bounds array check to dynamic_stitch_op. · tensorflow/tensorflow@ee004b1
TensorFlow is an open source platform for machine learning. Prior to versions 2.12.0 and 2.11.1, if the parameter indices
for DynamicStitch
does not match the shape of the parameter data
, it can trigger an stack OOB read. A fix is included in TensorFlow version 2.12.0 and version 2.11.1.
@@ -97,6 +97,17 @@ class DynamicStitchOpImplBase : public OpKernel {
*first_dim_size = max_index + 1;
for (const Tensor& indices : *indices_inputs) { auto indices_vec = indices.flat<int32>();
for (int i = 0; i < indices_vec.size(); i++) { int32_t index = internal::SubtleMustCopy(indices_vec(i)); OP_REQUIRES( c, FastBoundsCheck(index, *first_dim_size), errors::InvalidArgument("indices[“, i, "] is out of range”)); } }
// Validate that data[i].shape = indices[i].shape + constant OP_REQUIRES_OK(c, c->input_list("data", data_inputs)); const Tensor& data0 = (*data_inputs)[0]; @@ -265,9 +276,6 @@ class DynamicStitchOpImplCPU : public DynamicStitchOpImplBase<T> { const T* data_base = data_flat.data(); for (int i = 0; i < indices_vec.size(); i++) { int32_t index = internal::SubtleMustCopy(indices_vec(i)); OP_REQUIRES( c, FastBoundsCheck(index, first_dim_size), errors::InvalidArgument("indices[“, i, "] is out of range”)); memcpy(merged_base + index * slice_size, data_base + i * slice_size, slice_bytes); } @@ -277,9 +285,6 @@ class DynamicStitchOpImplCPU : public DynamicStitchOpImplBase<T> { // Copy slice data[i] to merged[indices[i]] Eigen::DSizes<Eigen::DenseIndex, 2> data_indices(i, 0); int32_t index = internal::SubtleMustCopy(indices_vec(i)); OP_REQUIRES( c, FastBoundsCheck(index, first_dim_size), errors::InvalidArgument("indices[“, i, "] is out of range”)); Eigen::DSizes<Eigen::DenseIndex, 2> merged_indices(index, 0); merged_flat.slice(merged_indices, sizes) = data_flat.slice(data_indices, sizes);
Related news
Vulnerability in the Oracle Hyperion Financial Reporting product of Oracle Hyperion (component: Repository). The supported version that is affected is 11.2.13.0.000. Easily exploitable vulnerability allows low privileged attacker with network access via HTTP to compromise Oracle Hyperion Financial Reporting. While the vulnerability is in Oracle Hyperion Financial Reporting, attacks may significantly impact additional products (scope change). Successful attacks of this vulnerability can result in unauthorized access to critical data or complete access to all Oracle Hyperion Financial Reporting accessible data and unauthorized ability to cause a partial denial of service (partial DOS) of Oracle Hyperion Financial Reporting. CVSS 3.1 Base Score 8.5 (Confidentiality and Availability impacts). CVSS Vector: (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:L).
### Impact If the parameter `indices` for `DynamicStitch` does not match the shape of the parameter `data`, it can trigger an stack OOB read. ```python import tensorflow as tf func = tf.raw_ops.DynamicStitch para={'indices': [[0xdeadbeef], [405], [519], [758], [1015]], 'data': [[110.27793884277344], [120.29475402832031], [157.2418212890625], [157.2626953125], [188.45382690429688]]} y = func(**para) ``` ### Patches We have patched the issue in GitHub commit [ee004b18b976eeb5a758020af8880236cd707d05](https://github.com/tensorflow/tensorflow/commit/ee004b18b976eeb5a758020af8880236cd707d05). The fix will be included in TensorFlow 2.12. We will also cherrypick this commit on TensorFlow 2.11.1. ### For more information Please consult [our security guide](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) for more information regarding the security model and how to contact us with issues and questions. ### Attribution This has been reported via Google OSS VRP.