CVE-2021-29567
JSON

2.5low

Lack of validation in `SparseDenseCwiseMul`

Severity
2.5low CVSS:3.1 by GitHub_M
Exploit likelihood
0.19% (higher than 8% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-wp3c-xw9g-gpcgBIT-TENSORFLOW-2021-29567PYSEC-2021-204PYSEC-2021-495PYSEC-2021-693

Description

TensorFlow is an end-to-end open source platform for machine learning. Due to lack of validation in `tf.raw_ops.SparseDenseCwiseMul`, an attacker can trigger denial of service via `CHECK`-fails or accesses to outside the bounds of heap allocated data. Since the implementation(https://github.com/tensorflow/tensorflow/blob/38178a2f7a681a7835bb0912702a134bfe3b4d84/tensorflow/core/kernels/sparse_dense_binary_op_shared.cc#L68-L80) only validates the rank of the input arguments but no constraints between dimensions(https://www.tensorflow.org/api_docs/python/tf/raw_ops/SparseDenseCwiseMul), an attacker can abuse them to trigger internal `CHECK` assertions (and cause program termination, denial of service) or to write to memory outside of bounds of heap allocated tensor buffers. 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 7ae2af34087fb4b5c8915279efd03da3b81028bcGitHub 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 7ae2af34087fb4b5c8915279efd03da3b81028bcGitHub 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 7ae2af34087fb4b5c8915279efd03da3b81028bcGitHub 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
NVD5.5medium CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
NVD2.1low CVSS:2.0AV:L/AC:L/Au:N/C:N/I:N/A:P
Bitnami Vulnerability Databasemedium rating

Classification

What each source says

CVE List

TensorFlow is an end-to-end open source platform for machine learning. Due to lack of validation in `tf.raw_ops.SparseDenseCwiseMul`, an attacker can trigger denial of service via `CHECK`-fails or accesses to outside the bounds of heap allocated data. Since the implementation(https://github.com/tensorflow/tensorflow/blob/38178a2f7a681a7835bb0912702a134bfe3b4d84/tensorflow/core/kernels/sparse_dense_binary_op_shared.cc#L68-L80) only validates the rank of the input arguments but no constraints between dimensions(https://www.tensorflow.org/api_docs/python/tf/raw_ops/SparseDenseCwiseMul), an attacker can abuse them to trigger internal `CHECK` assertions (and cause program termination, denial of service) or to write to memory outside of bounds of heap allocated tensor buffers. 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

Due to lack of validation in tf.raw_ops.SparseDenseCwiseMul, an attacker can trigger denial of service via CHECK-fails or accesses to outside the bounds of heap allocated data:

import tensorflow as tf

indices = tf.constant([], shape=[10, 0], dtype=tf.int64)
values = tf.constant([], shape=[0], dtype=tf.int64)
shape = tf.constant([0, 0], shape=[2], dtype=tf.int64)
dense = tf.constant([], shape=[0], dtype=tf.int64)
  
tf.raw_ops.SparseDenseCwiseMul(
    sp_indices=indices, sp_values=values, sp_shape=shape, dense=dense)

Since the implementation only validates the rank of the input arguments but no constraints between dimensions, an attacker can abuse them to trigger internal CHECK assertions (and cause program termination, denial of service) or to write to memory outside of bounds of heap allocated tensor buffers.

Patches

We have patched the issue in GitHub commit 7ae2af34087fb4b5c8915279efd03da3b81028bc.

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 Yakun Zhang and Ying Wang of Baidu X-Team.

NVD (es)

TensorFlow es una plataforma de código abierto de extremo a extremo para el aprendizaje automático.&#xa0;Debido a una falta de comprobación en "tf.raw_ops.SparseDenseCwiseMul", un atacante puede desencadenar una denegación de servicio por medio de fallos de "CHECK" o accesos fuera de límites de los datos asignados a la pila.&#xa0;Dado que la implementación (https://github.com/tensorflow/tensorflow/blob/38178a2f7a681a7835bb0912702a134bfe3b4d84/tensorflow/core/kernels/sparse_dense_binary_op_shared.cc#L68-L80) solo comprueba el rango de los argumentos de entrada (pero sin restricciones) //www.tensorflow.org/api_docs/python/tf/raw_ops/SparseDenseCwiseMul), un atacante puede abusar de ellos para activar aserciones internas "CHECK" (y causar la terminación del programa, denegación de servicio) o para escribir en una memoria fuera de límites de búferes tensoriales asignados a la pila.&#xa0;La corrección será incluida en TensorFlow versión 2.5.0

References

Sources

SourceRecordLicence
CVE ListCVE-2021-29567 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-wp3c-xw9g-gpcg changed 2026-07-08CC-BY-4.0
NVDCVE-2021-29567 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2021-204 changed 2023-12-06CC-BY-4.0
PyPA Advisory DatabasePYSEC-2021-495 changed 2023-12-06CC-BY-4.0
PyPA Advisory DatabasePYSEC-2021-693 changed 2023-12-06CC-BY-4.0
Bitnami Vulnerability DatabaseBIT-TENSORFLOW-2021-29567 changed 2026-09-08Apache-2.0