Source
ghsa
### Impact When [`mlir::tfg::TFOp::nameAttr`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/ir/importexport/graphdef_import.cc) receives null type list attributes, it crashes. ```cpp StatusOr<unsigned> GraphDefImporter::ArgNumType(const NamedAttrList &attrs, const OpDef::ArgDef &arg_def, SmallVectorImpl<Type> &types) { // Check whether a type list attribute is specified. if (!arg_def.type_list_attr().empty()) { if (auto v = attrs.get(arg_def.type_list_attr()).dyn_cast<ArrayAttr>()) { for (Attribute attr : v) { if (auto dtype = attr.dyn_cast<TypeAttr>()) { types.push_back(UnrankedTensorType::get(dtype.getValue())); } else { return InvalidArgument("Expected '", arg_def.type_list_attr(), "' to be a list of types"); } } return v.size(); } return NotFound("Type at...
### Impact When [`RangeSize`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/ops/math_ops.cc) receives values that do not fit into an `int64_t`, it crashes. ```cpp auto size = (std::is_integral<T>::value ? ((Eigen::numext::abs(limit - start) + Eigen::numext::abs(delta) - T(1)) / Eigen::numext::abs(delta)) : (Eigen::numext::ceil( Eigen::numext::abs((limit - start) / delta)))); // This check does not cover all cases. if (size > std::numeric_limits<int64_t>::max()) { return errors::InvalidArgument("Requires ((limit - start) / delta) <= ", std::numeric_limits<int64_t>::max()); } c->set_output(0, c->Vector(static_cast<int64_t>(size))); return Status::OK(); } ``` ### Patches We have patched the issue in GitHub commit [37e64539cd29fcfb814c4451152a60f5d107b0f0](https://github.com/tensorflow/tensorflow/commit/37e6...
### Impact When [`mlir::tfg::ConvertGenericFunctionToFunctionDef`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/ir/importexport/functiondef_import.cc) is given empty function attributes, it crashes. ```cpp // We pre-allocate the array of operands and populate it using the // `output_name_to_position` and `control_output_to_position` populated // previously. SmallVector<Value> ret_vals(func.ret_size() + func.control_ret_size(), Value()); for (const auto& ret_val : func.ret()) { auto position = output_name_to_position.find(ret_val.first); if (position == output_name_to_position.end()) return InvalidArgument( "Can't import function, returned value references unknown output " "argument ", ret_val.first); ret_vals[position->second] = value_manager.GetValueOrCreatePlaceholder(ret_val.second); } for (const auto& ret_val : func.control_ret()) { auto position = control_output_to_position.find(ret_val.f...
### Impact `DenseBincount` assumes its input tensor `weights` to either have the same shape as its input tensor `input` or to be length-0. A different `weights` shape will trigger a `CHECK` fail that can be used to trigger a denial of service attack. ```python import tensorflow as tf binary_output = True input = tf.random.uniform(shape=[0, 0], minval=-10000, maxval=10000, dtype=tf.int32, seed=-2460) size = tf.random.uniform(shape=[], minval=-10000, maxval=10000, dtype=tf.int32, seed=-10000) weights = tf.random.uniform(shape=[], minval=-10000, maxval=10000, dtype=tf.float32, seed=-10000) tf.raw_ops.DenseBincount(input=input, size=size, weights=weights, binary_output=binary_output) ``` ### Patches We have patched the issue in GitHub commit [bf4c14353c2328636a18bfad1e151052c81d5f43](https://github.com/tensorflow/tensorflow/commit/bf4c14353c2328636a18bfad1e151052c81d5f43). The fix will be included in TensorFlow 2.10.0. We will also cherrypick this commit on TensorFlow 2.9.1, TensorFlow 2...
### Impact The [`AvgPoolOp`](https://github.com/tensorflow/tensorflow/blob/8d72537c6abf5a44103b57b9c2e22c14f5f49698/tensorflow/core/kernels/avgpooling_op.cc#L56-L98) function takes an argument `ksize` that must be positive but is not checked. A negative `ksize` can trigger a `CHECK` failure and crash the program. ```python import tensorflow as tf import numpy as np value = np.ones([1, 1, 1, 1]) ksize = [1, 1e20, 1, 1] strides = [1, 1, 1, 1] padding = 'SAME' data_format = 'NHWC' tf.raw_ops.AvgPool(value=value, ksize=ksize, strides=strides, padding=padding, data_format=data_format) ``` ### Patches We have patched the issue in GitHub commit [3a6ac52664c6c095aa2b114e742b0aa17fdce78f](https://github.com/tensorflow/tensorflow/commit/3a6ac52664c6c095aa2b114e742b0aa17fdce78f). The fix will be included in TensorFlow 2.10.0. We will also cherrypick this commit on TensorFlow 2.9.1, TensorFlow 2.8.1, and TensorFlow 2.7.2, as these are also affected and still in supported range. ### For more ...
### Impact Internal fields (keys used internally by Parse Server, prefixed by `_`) and protected fields (user defined) can be used as query constraints. Internal and protected fields are removed by Parse Server from query results and are only returned to the client using a valid master key. However, using query constraints, these fields can be guessed by enumerating until Parse Server returns a response object. ### Patches The patch requires the maser key to use internal and protected fields as query constraints. ### Workarounds Implement a Parse Cloud Trigger `beforeFind` and manually remove the query constraints, such as: ```js Parse.Cloud.beforeFind('TestObject', ({ query }) => { for (const key in query._where || []) { // Repeat logic for protected fields if (key.charAt(0) === '_') { delete query._where[key]; } } }); ``` ### References - https://github.com/parse-community/parse-server/security/advisories/GHSA-2m6g-crv8-p3c6
### Impact If `QuantizeAndDequantizeV3` is given a nonscalar `num_bits` input tensor, it results in a `CHECK` fail that can be used to trigger a denial of service attack. ```python import tensorflow as tf signed_input = True range_given = False narrow_range = False axis = -1 input = tf.constant(-3.5, shape=[1], dtype=tf.float32) input_min = tf.constant(-3.5, shape=[1], dtype=tf.float32) input_max = tf.constant(-3.5, shape=[1], dtype=tf.float32) num_bits = tf.constant([], shape=[0], dtype=tf.int32) tf.raw_ops.QuantizeAndDequantizeV3(input=input, input_min=input_min, input_max=input_max, num_bits=num_bits, signed_input=signed_input, range_given=range_given, narrow_range=narrow_range, axis=axis) ``` ### Patches We have patched the issue in GitHub commit [f3f9cb38ecfe5a8a703f2c4a8fead434ef291713](https://github.com/tensorflow/tensorflow/commit/f3f9cb38ecfe5a8a703f2c4a8fead434ef291713). The fix will be included in TensorFlow 2.10.0. We will also cherrypick this commit on TensorFlow 2.9.1...
### Impact If `RaggedTensorToVariant` is given a `rt_nested_splits` list that contains tensors of ranks other than one, it results in a `CHECK` fail that can be used to trigger a denial of service attack. ```python import tensorflow as tf batched_input = True rt_nested_splits = tf.constant([0,32,64], shape=[3], dtype=tf.int64) rt_dense_values = tf.constant([0,32,64], shape=[3], dtype=tf.int64) tf.raw_ops.RaggedTensorToVariant(rt_nested_splits=rt_nested_splits, rt_dense_values=rt_dense_values, batched_input=batched_input) ``` ### Patches We have patched the issue in GitHub commit [88f93dfe691563baa4ae1e80ccde2d5c7a143821](https://github.com/tensorflow/tensorflow/commit/88f93dfe691563baa4ae1e80ccde2d5c7a143821). The fix will be included in TensorFlow 2.10.0. We will also cherrypick this commit on TensorFlow 2.9.1, TensorFlow 2.8.1, and TensorFlow 2.7.2, as these are also affected and still in supported range. ### For more information Please consult [our security guide](https://githu...
### Impact If `FakeQuantWithMinMaxVarsPerChannel` is given `min` or `max` tensors of a rank other than one, it results in a `CHECK` fail that can be used to trigger a denial of service attack. ```python import tensorflow as tf num_bits = 8 narrow_range = False inputs = tf.constant(0, shape=[4], dtype=tf.float32) min = tf.constant([], shape=[4,0,0], dtype=tf.float32) max = tf.constant(0, shape=[4], dtype=tf.float32) tf.raw_ops.FakeQuantWithMinMaxVarsPerChannel(inputs=inputs, min=min, max=max, num_bits=num_bits, narrow_range=narrow_range) ``` ### Patches We have patched the issue in GitHub commit [785d67a78a1d533759fcd2f5e8d6ef778de849e0](https://github.com/tensorflow/tensorflow/commit/785d67a78a1d533759fcd2f5e8d6ef778de849e0). The fix will be included in TensorFlow 2.10.0. We will also cherrypick this commit on TensorFlow 2.9.1, TensorFlow 2.8.1, and TensorFlow 2.7.2, as these are also affected and still in supported range. ### For more information Please consult [our security guid...
## Overview The issue lies in the implementation of the `cell_project` macro which used `field as *const _` instead of `field as *mut _`. The problem being that `*const T` is covariant in `T` while `*mut T` is invariant in `T`. Keep in mind that `&Cell<T>` is invariant in `T`, so casting to `*const T` relaxed the variance, and lead to unsoundness, as shown in the example below. ```rs use std::cell::Cell; use cell_project::cell_project as cp; struct Foo<'a> { x: Option<&'a Cell<Foo<'a>>>, } impl<'a> Drop for Foo<'a> { fn drop(&mut self) { // `ourselves` is an &Cell<Self>. // NB: `Drop` is unsound. if let Some(ourselves) = self.x.as_ref() { // replace `self` (but this doesn't actually replace `self`) let is_x_none = ourselves.replace(Foo { x: None, }).x.as_ref().is_none(); // if we just moved out of `self`, and we had a `Some` originally, // how come this is a `None`? ...