`CHECK` fail in `tf.sparse.cross` in TensorFlow
Description
TensorFlow is an open source platform for machine learning. If tf.sparse.cross receives an input separator that is not a scalar, it gives a CHECK fail that can be used to trigger a denial of service attack. We have patched the issue in GitHub commit 83dcb4dbfa094e33db084e97c4d0531a559e0ebf. 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.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 |
Affected products
1- Range: < 2.7.2
Patches
183dcb4dbfa09Fix check failure in SparseCrossV2Op by adding check for scalar value for separator.
2 files changed · +14 −0
tensorflow/core/kernels/sparse_cross_op.cc+6 −0 modified@@ -24,12 +24,14 @@ limitations under the License. #include "tensorflow/core/framework/kernel_def_builder.h" #include "tensorflow/core/framework/op_def_builder.h" #include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/framework/op_requires.h" #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/framework/tensor_shape.h" #include "tensorflow/core/framework/types.h" #include "tensorflow/core/framework/types.pb.h" #include "tensorflow/core/lib/core/stringpiece.h" #include "tensorflow/core/lib/strings/str_util.h" +#include "tensorflow/core/platform/errors.h" #include "tensorflow/core/platform/fingerprint.h" #include "tensorflow/core/platform/strong_hash.h" #include "tensorflow/core/util/work_sharder.h" @@ -832,6 +834,10 @@ class SparseCrossV2Op : public OpKernel { const Tensor* sep_t; OP_REQUIRES_OK(context, context->input("sep", &sep_t)); + OP_REQUIRES(context, TensorShapeUtils::IsScalar(sep_t->shape()), + errors::InvalidArgument("Input separator should be a scalar. " + "Received: ", + sep_t->DebugString())); const tstring separator = sep_t->scalar<tstring>()(); std::vector<std::unique_ptr<ColumnInterface<tstring>>> columns =
tensorflow/python/kernel_tests/sparse_ops/sparse_cross_op_test.py+8 −0 modified@@ -873,6 +873,14 @@ def test_all_columns_empty(self): with self.cached_session(): self._assert_sparse_tensor_empty(self.evaluate(out)) + def testNonScalarInput(self): + with self.assertRaisesRegex(errors.InvalidArgumentError, + 'Input separator should be a scalar.'): + self.evaluate(sparse_ops.sparse_cross( + inputs=[], + name='a', + separator=constant_op.constant(['a', 'b'], dtype=dtypes.string))) + class SparseCrossHashedOpTest(BaseSparseCrossOpTest):
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-p7hr-f446-x6qfghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2022-35997ghsaADVISORY
- github.com/tensorflow/tensorflow/commit/83dcb4dbfa094e33db084e97c4d0531a559e0ebfghsax_refsource_MISCWEB
- github.com/tensorflow/tensorflow/releases/tag/v2.10.0ghsaWEB
- github.com/tensorflow/tensorflow/security/advisories/GHSA-p7hr-f446-x6qfghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.