`CHECK` fail in `Conv2DBackpropInput` in TensorFlow
Description
TensorFlow is an open source platform for machine learning. The implementation of Conv2DBackpropInput requires input_sizes to be 4-dimensional. Otherwise, it gives a CHECK failure which can be used to trigger a denial of service attack. We have patched the issue in GitHub commit 50156d547b9a1da0144d7babe665cf690305b33c. 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. There are no known workarounds for this issue.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
tensorflowPyPI | < 2.7.2 | 2.7.2 |
tensorflowPyPI | >= 2.8.0, < 2.8.1 | 2.8.1 |
tensorflowPyPI | >= 2.9.0, < 2.9.1 | 2.9.1 |
tensorflow-cpuPyPI | < 2.7.2 | 2.7.2 |
tensorflow-cpuPyPI | >= 2.8.0, < 2.8.1 | 2.8.1 |
tensorflow-cpuPyPI | >= 2.9.0, < 2.9.1 | 2.9.1 |
tensorflow-gpuPyPI | < 2.7.2 | 2.7.2 |
tensorflow-gpuPyPI | >= 2.8.0, < 2.8.1 | 2.8.1 |
tensorflow-gpuPyPI | >= 2.9.0, < 2.9.1 | 2.9.1 |
Affected products
1- Range: < 2.7.2
Patches
150156d547b9aAdd security vulnerability test for raw_ops.Conv2DBackpropInput
2 files changed · +35 −4
tensorflow/core/kernels/conv_grad_input_ops.h+9 −0 modified@@ -422,6 +422,11 @@ class Conv2DBackpropInputOp : public OpKernel { const Tensor& filter = context->input(1); const Tensor& out_backprop = context->input(2); + OP_REQUIRES( + context, out_backprop.dims() == 4, + errors::InvalidArgument("input_sizes must be 4-dimensional, got: ", + out_backprop.dims())); + TensorShape input_shape; OP_REQUIRES_OK(context, Conv2DBackpropComputeInputShape(input_sizes, filter.shape(), @@ -527,6 +532,10 @@ class Conv2DCustomBackpropInputOp : public OpKernel { const Tensor& input_sizes = context->input(0); const Tensor& filter = context->input(1); const Tensor& out_backprop = context->input(2); + OP_REQUIRES( + context, out_backprop.dims() == 4, + errors::InvalidArgument("input_sizes must be 4-dimensional, got: ", + out_backprop.dims())); TensorShape input_shape; OP_REQUIRES_OK(context,
tensorflow/python/kernel_tests/nn_ops/conv_ops_test.py+26 −4 modified@@ -32,6 +32,7 @@ from tensorflow.python.layers import convolutional from tensorflow.python.ops import array_ops from tensorflow.python.ops import control_flow_ops +from tensorflow.python.ops import gen_nn_ops from tensorflow.python.ops import gradient_checker from tensorflow.python.ops import gradients_impl from tensorflow.python.ops import math_ops @@ -1319,7 +1320,7 @@ def _RunAndVerifyBackpropInputDilation(self, input_sizes, filter_sizes, x2 = self._CreateNumpyTensor(filter_sizes) default_dilations = (dilations[0] == 1 and dilations[1] == 1) if default_dilations or use_gpu: - with self.cached_session(use_gpu=use_gpu) as sess: + with self.cached_session(use_gpu=use_gpu): if data_format == "NCHW": input_sizes = test_util.NHWCToNCHW(input_sizes) t1 = constant_op.constant(x1, shape=input_sizes) @@ -1365,7 +1366,7 @@ def _RunAndVerifyBackpropFilterDilation(self, input_sizes, filter_sizes, x2 = self._CreateNumpyTensor(filter_sizes) default_dilations = (dilations[0] == 1 and dilations[1] == 1) if default_dilations or use_gpu: - with self.cached_session(use_gpu=use_gpu) as sess: + with self.cached_session(use_gpu=use_gpu): if data_format == "NCHW": input_sizes = test_util.NHWCToNCHW(input_sizes) t1 = constant_op.constant(x1, shape=input_sizes) @@ -2628,6 +2629,27 @@ def testOpEdgeCases(self): strides=[1, 1, 1, 1], padding=[[0, 0], [-1, 0], [0, 0], [0, 0]])) + def testConv2DBackpropInputInvalidOutBackpropRaiseError(self): + with self.assertRaises((ValueError, errors_impl.InvalidArgumentError)): + with self.cached_session(): + input_sizes = constant_op.constant([65534, 65534], + shape=[2], + dtype=dtypes.int32) + filters = constant_op.constant( + 0.159749106, shape=[3, 3, 2, 2], dtype=dtypes.float32) + out_backprop = constant_op.constant(0, shape=[], dtype=dtypes.float32) + t = gen_nn_ops.conv2d_backprop_input( + input_sizes=input_sizes, + filter=filters, + out_backprop=out_backprop, + strides=[1, 1, 1, 1], + padding="SAME", + use_cudnn_on_gpu=True, + explicit_paddings=[], + data_format="NHWC", + dilations=[1, 1, 1, 1]) + self.evaluate(t) + @test_util.run_all_without_tensor_float_32("Avoid TF32 conv on GPU") class DepthwiseConv2DTest(test.TestCase): @@ -2655,7 +2677,7 @@ def _VerifyValues(self, tensor_in_sizes, filter_in_sizes, stride, padding, # numbers from 1. x1 = [f * 1.0 for f in range(1, total_size_1 + 1)] x2 = [f * 1.0 for f in range(1, total_size_2 + 1)] - with self.cached_session() as sess: + with self.cached_session(): t1 = constant_op.constant(x1, shape=tensor_in_sizes) t1.set_shape(tensor_in_sizes) t2 = constant_op.constant(x2, shape=filter_in_sizes) @@ -2926,7 +2948,7 @@ def _CompareFwdConv2D(self, tensor_in_sizes, filter_in_sizes, conv_strides, x1 = np.random.rand(*tensor_in_sizes).astype(np.float32) x2 = np.random.rand(*filter_in_sizes).astype(np.float32) - with self.cached_session(use_gpu=False) as sess: + with self.cached_session(use_gpu=False): t1 = constant_op.constant(x1, shape=tensor_in_sizes) t2 = constant_op.constant(x2, shape=filter_in_sizes) strides = [1] + conv_strides + [1]
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/advisories/GHSA-q2c3-jpmc-gfjxghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2022-35969ghsaADVISORY
- github.com/tensorflow/tensorflow/commit/50156d547b9a1da0144d7babe665cf690305b33cghsax_refsource_MISCWEB
- github.com/tensorflow/tensorflow/releases/tag/v2.10.0ghsaWEB
- github.com/tensorflow/tensorflow/security/advisories/GHSA-q2c3-jpmc-gfjxghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.