VYPR
Low severityNVD Advisory· Published May 14, 2021· Updated Aug 3, 2024

Heap OOB in `QuantizeAndDequantizeV3`

CVE-2021-29553

Description

TensorFlow is an end-to-end open source platform for machine learning. An attacker can read data outside of bounds of heap allocated buffer in tf.raw_ops.QuantizeAndDequantizeV3. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/11ff7f80667e6490d7b5174aa6bf5e01886e770f/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L237) does not validate the value of user supplied axis attribute before using it to index in the array backing the input argument. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.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.1.42.1.4
tensorflowPyPI
>= 2.2.0, < 2.2.32.2.3
tensorflowPyPI
>= 2.3.0, < 2.3.32.3.3
tensorflowPyPI
>= 2.4.0, < 2.4.22.4.2
tensorflow-cpuPyPI
< 2.1.42.1.4
tensorflow-cpuPyPI
>= 2.2.0, < 2.2.32.2.3
tensorflow-cpuPyPI
>= 2.3.0, < 2.3.32.3.3
tensorflow-cpuPyPI
>= 2.4.0, < 2.4.22.4.2
tensorflow-gpuPyPI
< 2.1.42.1.4
tensorflow-gpuPyPI
>= 2.2.0, < 2.2.32.2.3
tensorflow-gpuPyPI
>= 2.3.0, < 2.3.32.3.3
tensorflow-gpuPyPI
>= 2.4.0, < 2.4.22.4.2

Affected products

1

Patches

1
99085e8ff02c

Fix `tf.raw_ops.QuantizeAndDequantizeV3` array index failure.

https://github.com/tensorflow/tensorflowAmit PatankarApr 27, 2021via ghsa
1 file changed · +5 0
  • tensorflow/core/kernels/quantize_and_dequantize_op.cc+5 0 modified
    @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
     limitations under the License.
     ==============================================================================*/
     
    +#include "tensorflow/core/framework/op_requires.h"
     #define EIGEN_USE_THREADS
     
     #if (defined(GOOGLE_CUDA) && GOOGLE_CUDA) || \
    @@ -234,6 +235,10 @@ class QuantizeAndDequantizeV3Op : public OpKernel {
     
       void Compute(OpKernelContext* ctx) override {
         const Tensor& input = ctx->input(0);
    +    OP_REQUIRES(ctx, axis_ < input.dims(),
    +                errors::InvalidArgument(
    +                    "Axis requested is larger than input dimensions. Axis: ",
    +                    axis_, " Input Dimensions: ", input.dims()));
         const int depth = (axis_ == -1) ? 1 : input.dim_size(axis_);
         Tensor* output = nullptr;
         OP_REQUIRES_OK(ctx, ctx->allocate_output(0, input.shape(), &output));
    

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.