VYPR
High severityNVD Advisory· Published Aug 12, 2021· Updated Aug 4, 2024

Heap OOB and CHECK fail in `ResourceGather` in TensorFlow

CVE-2021-37654

Description

TensorFlow is an end-to-end open source platform for machine learning. In affected versions an attacker can trigger a crash via a CHECK-fail in debug builds of TensorFlow using tf.raw_ops.ResourceGather or a read from outside the bounds of heap allocated data in the same API in a release build. The implementation does not check that the batch_dims value that the user supplies is less than the rank of the input tensor. Since the implementation uses several for loops over the dimensions of tensor, this results in reading data from outside the bounds of heap allocated buffer backing the tensor. We have patched the issue in GitHub commit bc9c546ce7015c57c2f15c168b3d9201de679a1d. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, as these are also affected and still in supported range.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
tensorflowPyPI
< 2.3.42.3.4
tensorflowPyPI
>= 2.4.0, < 2.4.32.4.3
tensorflowPyPI
>= 2.5.0, < 2.5.12.5.1
tensorflow-cpuPyPI
< 2.3.42.3.4
tensorflow-cpuPyPI
>= 2.4.0, < 2.4.32.4.3
tensorflow-cpuPyPI
>= 2.5.0, < 2.5.12.5.1
tensorflow-gpuPyPI
< 2.3.42.3.4
tensorflow-gpuPyPI
>= 2.4.0, < 2.4.32.4.3
tensorflow-gpuPyPI
>= 2.5.0, < 2.5.12.5.1

Affected products

1

Patches

1
bc9c546ce701

Prevent heap oob access in `resource_variable_ops.cc`

https://github.com/tensorflow/tensorflowMihai MaruseacJul 31, 2021via ghsa
1 file changed · +5 0
  • tensorflow/core/kernels/resource_variable_ops.cc+5 0 modified
    @@ -660,6 +660,11 @@ class ResourceGatherOp : public OpKernel {
         OP_REQUIRES(
             c, TensorShapeUtils::IsVectorOrHigher(params.shape()),
             errors::InvalidArgument("params must be at least 1 dimensional"));
    +    OP_REQUIRES(
    +        c, params.shape().dims() >= batch_dims_,
    +        errors::InvalidArgument("params must have at least ", batch_dims_,
    +                                " (batch_dims) dimensions but it has shape ",
    +                                params.shape().DebugString()));
     
         // Check that we have enough index space
         const int64_t N = indices.NumElements();
    

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

7

News mentions

0

No linked articles in our index yet.