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

Incomplete validation in `MaxPoolGrad` in TensorFlow

CVE-2021-37674

Description

TensorFlow is an end-to-end open source platform for machine learning. In affected versions an attacker can trigger a denial of service via a segmentation fault in tf.raw_ops.MaxPoolGrad caused by missing validation. The implementation misses some validation for the orig_input and orig_output tensors. The fixes for CVE-2021-29579 were incomplete. We have patched the issue in GitHub commit 136b51f10903e044308cf77117c0ed9871350475. 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
136b51f10903

Add missing validation to `maxpooling_op.cc`

https://github.com/tensorflow/tensorflowMihai MaruseacJul 31, 2021via ghsa
2 files changed · +7 0
  • tensorflow/core/kernels/maxpooling_op.cc+5 0 modified
    @@ -74,6 +74,7 @@ static void SpatialMaxPoolWithArgMaxHelper(
             errors::Internal("SpatialMaxPoolWithArgMaxHelper requires Targmax "
                              "to be int64 when input_backprop != nullptr"));
       }
    +  if (tensor_in.NumElements() == 0 || output->NumElements() == 0) return;
     
       typedef Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>>
           ConstEigenMatrixMap;
    @@ -949,6 +950,10 @@ class MaxPoolingWithArgmaxOp : public OpKernel {
     
       void Compute(OpKernelContext* context) override {
         const Tensor& tensor_in = context->input(0);
    +    OP_REQUIRES(context, tensor_in.dims() == 4,
    +                errors::InvalidArgument("tensor_in must be 4-dimensional (2)"));
    +    OP_REQUIRES(context, tensor_in.NumElements() > 0,
    +                errors::InvalidArgument("tensor_in must not be empty (2)"));
     
         PoolParameters params{context,
                               ksize_,
    
  • tensorflow/core/kernels/pooling_ops_common.cc+2 0 modified
    @@ -171,6 +171,8 @@ PoolParameters::PoolParameters(OpKernelContext* context,
         pad_depth = 0;
         out_depth = depth;
       } else {
    +    OP_REQUIRES(context, depth_window > 0,
    +                errors::InvalidArgument("depth_window must not be 0"));
         // Our current version of depthwise max pooling does not support
         // any padding, and expects the depth_window to equal the
         // depth_stride (no overlapping).
    

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

8

News mentions

0

No linked articles in our index yet.