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

Reference binding to nullptr in shape inference in TensorFlow

CVE-2021-37676

Description

TensorFlow is an end-to-end open source platform for machine learning. In affected versions an attacker can cause undefined behavior via binding a reference to null pointer in tf.raw_ops.SparseFillEmptyRows. The shape inference implementation does not validate that the input arguments are not empty tensors. We have patched the issue in GitHub commit 578e634b4f1c1c684d4b4294f9e5281b2133b3ed. 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
578e634b4f1c

Prevent a segfault in shape inference due to bad inputs.

https://github.com/tensorflow/tensorflowMihai MaruseacJul 30, 2021via ghsa
1 file changed · +3 0
  • tensorflow/core/ops/sparse_ops.cc+3 0 modified
    @@ -16,6 +16,7 @@ limitations under the License.
     #include "tensorflow/core/framework/common_shape_fns.h"
     #include "tensorflow/core/framework/op.h"
     #include "tensorflow/core/framework/shape_inference.h"
    +#include "tensorflow/core/platform/errors.h"
     
     namespace tensorflow {
     
    @@ -619,6 +620,8 @@ REGISTER_OP("SparseFillEmptyRows")
           DimensionHandle unused_dim;
           TF_RETURN_IF_ERROR(c->Merge(c->Dim(input_indices, 1),
                                       c->Dim(input_shape, 0), &unused_dim));
    +      if (c->Value(c->NumElements(input_shape)) == 0)
    +        return errors::InvalidArgument("dense_shape must not be empty");
           ShapeHandle output_indices =
               c->Matrix(InferenceContext::kUnknownDim, c->NumElements(input_shape));
           ShapeHandle output_values = c->Vector(InferenceContext::kUnknownDim);
    

Vulnerability mechanics

Synthesis attempt was rejected by the grounding validator. Re-run pending.

References

7

News mentions

0

No linked articles in our index yet.