CVE-2023-25661 (published 2023-03-27T20:15Z)

TensorFlow is an Open Source Machine Learning Framework. In versions prior to 2.11.1 a malicious invalid input crashes a tensorflow model (Check Failed) and can be used to trigger a denial of service attack. A proof of concept can be constructed with the `Convolution3DTranspose` function. This Convolution3DTranspose layer is a very common API in modern neural networks. The ML models containing such vulnerable components could be deployed in ML applications or as cloud services. This failure could be potentially used to trigger a denial of service attack on ML cloud services. An attacker must have privilege to provide input to a `Convolution3DTranspose` call. This issue has been patched and users are advised to upgrade to version 2.11.1. There are no known workarounds for this vulnerability.

CVSS v3 base score: 6.5, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H)

Weakness information:
cwe_id: NVD-CWE-noinfo
cwe_name: Insufficient Information
description: There is insufficient information about the issue to classify it; details are unkown or unspecified.
extended_description: Insufficient Information

Fix information:
repo_url: https://github.com/tensorflow/tensorflow
commit_details: repo_url: https://github.com/tensorflow/tensorflow
author: Zhufeng Pan
author_date: 2022-11-08 11:12:10-08:00
msg: Fix nn.conv3d_transpose security vulnerability with illegal input shape

PiperOrigin-RevId: 487000656
repository: repo_url: https://github.com/tensorflow/tensorflow
repo_name: tensorflow/tensorflow
description: An Open Source Machine Learning Framework for Everyone
repo_language: C++
owner: tensorflow
file_changes: filename: conv_grad_ops_3d.cc
change_type: ModificationType.MODIFY
diff: @@ -1322,6 +1322,11 @@ class Conv3DBackpropInputOp<GPUDevice, T> : public OpKernel {
     Tensor* in_backprop;
     OP_REQUIRES_OK(context,
                    context->allocate_output(0, input_shape, &in_backprop));
+    for (std::size_t i = 0; i < input_shape.dims(); ++i) {
+      if (input_shape.dim_size(i) == 0) {
+        return;
+      }
+    }
 
     auto* stream = context->op_device_context()->stream();
     OP_REQUIRES(context, stream, errors::Internal("No GPU stream available."));

programming_language: C++
filename: conv3d_transpose_test.py
change_type: ModificationType.MODIFY
diff: @@ -126,7 +126,7 @@ class Conv3DTransposeTest(test.TestCase):
     x_value = np.random.random_sample(x_shape).astype(np.float64)
     f_value = np.random.random_sample(f_shape).astype(np.float64)
     nn_ops.conv3d_transpose(
-        x_value, f_value, y_shape, strides, data_format='NCDHW')
+        x_value, f_value, y_shape, strides, data_format="NCDHW")
 
   def testConv3DTransposeOutputShapeType(self):
     # Test case for GitHub issue 18887
@@ -218,6 +218,20 @@ class Conv3DTransposeTest(test.TestCase):
     err_tolerance = 0.00055
     self.assertLess(err, err_tolerance)
 
+  def testConv3DTransposeZeroShapeDoNotRaiseError(self):
+    with self.cached_session():
+      x_value = np.zeros([10, 0, 2, 3, 3])
+      f_value = np.ones((3, 3, 3, 3, 3))
+      y_shape = np.stack([10, 0, 2, 3, 3])
+      output = nn_ops.conv3d_transpose(
+          x_value,
+          f_value,
+          y_shape,
+          strides=(1, 1, 1),
+          data_format="NDHWC",
+          padding="SAME",
+      )
+      _ = self.evaluate(output)
 
 if __name__ == "__main__":
   test.main()

programming_language: Python