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

Heap OOB in `UpperBound` and `LowerBound` in TensorFlow

CVE-2021-37670

Description

TensorFlow is an end-to-end open source platform for machine learning. In affected versions an attacker can read from outside of bounds of heap allocated data by sending specially crafted illegal arguments to tf.raw_ops.UpperBound. The implementation does not validate the rank of sorted_input argument. A similar issue occurs in tf.raw_ops.LowerBound. We have patched the issue in GitHub commit 42459e4273c2e47a3232cc16c4f4fff3b3a35c38. 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
42459e4273c2

Prevent CHECK-fail/heap OOB in UpperBound and LowerBound

https://github.com/tensorflow/tensorflowMihai MaruseacJul 30, 2021via ghsa
1 file changed · +8 0
  • tensorflow/core/kernels/searchsorted_op.cc+8 0 modified
    @@ -86,6 +86,10 @@ class UpperBoundOp : public OpKernel {
         const Tensor& sorted_inputs_t = ctx->input(0);
         const Tensor& values_t = ctx->input(1);
     
    +    // inputs must be at least a matrix
    +    OP_REQUIRES(
    +        ctx, sorted_inputs_t.shape().dims() >= 2,
    +        errors::InvalidArgument("sorted input argument must be a matrix"));
         // must have same batch dim_size for both
         OP_REQUIRES(ctx, sorted_inputs_t.dim_size(0) == values_t.dim_size(0),
                     Status(error::INVALID_ARGUMENT,
    @@ -127,6 +131,10 @@ class LowerBoundOp : public OpKernel {
         const Tensor& sorted_inputs_t = ctx->input(0);
         const Tensor& values_t = ctx->input(1);
     
    +    // inputs must be at least a matrix
    +    OP_REQUIRES(
    +        ctx, sorted_inputs_t.shape().dims() >= 2,
    +        errors::InvalidArgument("sorted input argument must be a matrix"));
         // must have same batch dim_size for both
         OP_REQUIRES(ctx, sorted_inputs_t.dim_size(0) == values_t.dim_size(0),
                     Status(error::INVALID_ARGUMENT,
    

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.