VYPR
Moderate severityNVD Advisory· Published May 20, 2022· Updated Apr 22, 2025

Missing validation causes denial of service in TensorFlow via `StagePeek`

CVE-2022-29195

Description

TensorFlow is an open source platform for machine learning. Prior to versions 2.9.0, 2.8.1, 2.7.2, and 2.6.4, the implementation of tf.raw_ops.StagePeek does not fully validate the input arguments. This results in a CHECK-failure which can be used to trigger a denial of service attack. The code assumes index is a scalar but there is no validation for this before accessing its value. Versions 2.9.0, 2.8.1, 2.7.2, and 2.6.4 contain a patch for this issue.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
tensorflowPyPI
< 2.6.42.6.4
tensorflowPyPI
>= 2.7.0, < 2.7.22.7.2
tensorflowPyPI
>= 2.8.0, < 2.8.12.8.1
tensorflow-cpuPyPI
< 2.6.42.6.4
tensorflow-cpuPyPI
>= 2.7.0, < 2.7.22.7.2
tensorflow-cpuPyPI
>= 2.8.0, < 2.8.12.8.1
tensorflow-gpuPyPI
< 2.6.42.6.4
tensorflow-gpuPyPI
>= 2.7.0, < 2.7.22.7.2
tensorflow-gpuPyPI
>= 2.8.0, < 2.8.12.8.1

Affected products

1

Patches

1
cebe3c45d763

Fix tf.raw_ops.StagePeek vulnerability with invalid `index`.

https://github.com/tensorflow/tensorflowAlan LiuApr 29, 2022via ghsa
3 files changed · +14 1
  • tensorflow/core/kernels/stage_op.cc+2 0 modified
    @@ -258,6 +258,8 @@ class StagePeekOp : public OpKernel {
         core::ScopedUnref scope(buf);
         Buffer::Tuple tuple;
     
    +    OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(ctx->input(0).shape()),
    +                errors::InvalidArgument("index must be scalar"));
         std::size_t index = ctx->input(0).scalar<int>()();
     
         OP_REQUIRES_OK(ctx, buf->Peek(index, &tuple));
    
  • tensorflow/python/kernel_tests/data_structures/stage_op_test.py+11 0 modified
    @@ -13,6 +13,7 @@
     # limitations under the License.
     # ==============================================================================
     from tensorflow.python.framework import dtypes
    +from tensorflow.python.framework import errors
     from tensorflow.python.framework import ops
     from tensorflow.python.framework import test_util
     from tensorflow.python.ops import array_ops
    @@ -134,6 +135,16 @@ def testPeek(self):
           for i in range(10):
             self.assertTrue(sess.run(peek, feed_dict={p: i}) == [i])
     
    +  def testPeekBadIndex(self):
    +    stager = data_flow_ops.StagingArea([
    +        dtypes.int32,
    +    ], shapes=[[10]])
    +    stager.put([array_ops.zeros([10], dtype=dtypes.int32)])
    +
    +    with self.assertRaisesRegex((ValueError, errors.InvalidArgumentError),
    +                                'must be scalar'):
    +      self.evaluate(stager.peek([]))
    +
       @test_util.run_deprecated_v1
       def testSizeAndClear(self):
         with ops.Graph().as_default() as G:
    
  • tensorflow/python/ops/data_flow_ops.py+1 1 modified
    @@ -1737,7 +1737,7 @@ def _check_put_dtypes(self, vals, indices=None):
     
         # Sanity check number of values
         if not len(vals) <= len(self._dtypes):
    -      raise ValueError(f"Unexpected number of inputs {len(vals)} vs"
    +      raise ValueError(f"Unexpected number of inputs {len(vals)} vs "
                            f"{len(self._dtypes)}")
     
         tensors = []
    

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

9

News mentions

0

No linked articles in our index yet.