CVE-2021-29577
JSON

2.5low

Heap buffer overflow in `AvgPool3DGrad`

Severity
2.5low CVSS:3.1 by GitHub_M
Exploit likelihood
0.21% (higher than 11% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-v6r6-84gr-92rmBIT-TENSORFLOW-2021-29577PYSEC-2021-214PYSEC-2021-505PYSEC-2021-703

Description

TensorFlow is an end-to-end open source platform for machine learning. The implementation of `tf.raw_ops.AvgPool3DGrad` is vulnerable to a heap buffer overflow. The implementation(https://github.com/tensorflow/tensorflow/blob/d80ffba9702dc19d1fac74fc4b766b3fa1ee976b/tensorflow/core/kernels/pooling_ops_3d.cc#L376-L450) assumes that the `orig_input_shape` and `grad` tensors have similar first and last dimensions but does not check that this assumption is validated. 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

Product or packageVersionsReported by
tensorflow tensorflow< 2.1.4, >= 2.2.0, < 2.2.3, >= 2.3.0, < 2.3.3, >= 2.4.0, < 2.4.2CVE List
tensorflow (PyPI)before 2.1.4, from 2.2.0 before 2.2.3, from 2.3.0 before 2.3.3, from 2.4.0 before 2.4.2, before 6fc9141f42f6a72180ecd24021c3e6b36165fe0dGitHub Advisory Database, PyPA Advisory Database
tensorflow-cpu (PyPI)before 2.1.4, from 2.2.0 before 2.2.3, from 2.3.0 before 2.3.3, from 2.4.0 before 2.4.2, before 6fc9141f42f6a72180ecd24021c3e6b36165fe0dGitHub Advisory Database, PyPA Advisory Database
tensorflow-gpu (PyPI)before 2.1.4, from 2.2.0 before 2.2.3, from 2.3.0 before 2.3.3, from 2.4.0 before 2.4.2, before 6fc9141f42f6a72180ecd24021c3e6b36165fe0dGitHub Advisory Database, PyPA Advisory Database
google tensorflowbefore 2.1.4, from 2.2.0 before 2.2.3, from 2.3.0 before 2.3.3, from 2.4.0 before 2.4.2NVD
tensorflow (Bitnami)before 2.1.4, from 2.2.0 before 2.2.3, from 2.3.0 before 2.3.3, from 2.4.0 before 2.4.2Bitnami Vulnerability Database

All scores

GitHub_M2.5low CVSS:3.1CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L
GitHub2.5low CVSS:3.1CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L
GitHublow CVSS:4.0CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N
NVD7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD4.6medium CVSS:2.0AV:L/AC:L/Au:N/C:P/I:P/A:P
Bitnami Vulnerability Databasehigh rating

Classification

What each source says

CVE List

TensorFlow is an end-to-end open source platform for machine learning. The implementation of `tf.raw_ops.AvgPool3DGrad` is vulnerable to a heap buffer overflow. The implementation(https://github.com/tensorflow/tensorflow/blob/d80ffba9702dc19d1fac74fc4b766b3fa1ee976b/tensorflow/core/kernels/pooling_ops_3d.cc#L376-L450) assumes that the `orig_input_shape` and `grad` tensors have similar first and last dimensions but does not check that this assumption is validated. 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.

GitHub Advisory Database
Impact

The implementation of tf.raw_ops.AvgPool3DGrad is vulnerable to a heap buffer overflow:

import tensorflow as tf

orig_input_shape = tf.constant([10, 6, 3, 7, 7], shape=[5], dtype=tf.int32)
grad = tf.constant([0.01, 0, 0], shape=[3, 1, 1, 1, 1], dtype=tf.float32)
ksize = [1, 1, 1, 1, 1]
strides = [1, 1, 1, 1, 1]
padding = "SAME"

tf.raw_ops.AvgPool3DGrad(
  orig_input_shape=orig_input_shape, grad=grad, ksize=ksize, strides=strides,
  padding=padding)

The implementation assumes that the orig_input_shape and grad tensors have similar first and last dimensions but does not check that this assumption is validated.

Patches

We have patched the issue in GitHub commit 6fc9141f42f6a72180ecd24021c3e6b36165fe0d.

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.

For more information

Please consult our security guide for more information regarding the security model and how to contact us with issues and questions.

Attribution

This vulnerability has been reported by Ying Wang and Yakun Zhang of Baidu X-Team.

NVD (es)

TensorFlow es una plataforma de código abierto de extremo a extremo para el aprendizaje automático.&#xa0;La implementación de "tf.raw_ops.AvgPool3DGrad" es vulnerable a un desbordamiento del búfer de la pila.&#xa0;La implementación (https://github.com/tensorflow/tensorflow/blob/d80ffba9702dc19d1fac74fc4b766b3fa1ee976b/tensorflow/core/kernels/pooling_ops_3d.cc#L376-L450) asume que las dimensiones al inicio y al final de los tensores "orig_input_shape" y "grad" son similares pero no comprueba que esta suposición esté validada.&#xa0;La corrección será incluida en TensorFlow versión 2.5.0.&#xa0;También seleccionaremos este compromiso en TensorFlow versión 2.4.2, TensorFlow versión 2.3.3, TensorFlow versión 2.2.3 y TensorFlow versión 2.1.4, ya que estos también están afectados y aún están en el rango admitido

References

Sources

SourceRecordLicence
CVE ListCVE-2021-29577 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-v6r6-84gr-92rm changed 2026-07-08CC-BY-4.0
NVDCVE-2021-29577 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2021-214 changed 2023-12-06CC-BY-4.0
PyPA Advisory DatabasePYSEC-2021-505 changed 2023-12-06CC-BY-4.0
PyPA Advisory DatabasePYSEC-2021-703 changed 2023-12-06CC-BY-4.0
Bitnami Vulnerability DatabaseBIT-TENSORFLOW-2021-29577 changed 2026-09-08Apache-2.0