CVE-2021-29544
JSON

2.5low

CHECK-fail in `QuantizeAndDequantizeV4Grad`

Severity
2.5low CVSS:3.1 by GitHub_M
Exploit likelihood
0.31% (higher than 25% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-6g85-3hm8-83f9BIT-TENSORFLOW-2021-29544PYSEC-2021-181PYSEC-2021-472PYSEC-2021-670

Description

TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger a denial of service via a `CHECK`-fail in `tf.raw_ops.QuantizeAndDequantizeV4Grad`. This is because the implementation does not validate the rank of the `input_*` tensors. In turn, this results in the tensors being passes as they are to `QuantizeAndDequantizePerChannelGradientImpl`. However, the `vec<T>` method, requires the rank to 1 and triggers a `CHECK` failure otherwise. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2 as this is the only other affected version.

Affected

Product or packageVersionsReported by
tensorflow tensorflow>= 2.4.0, < 2.4.2CVE List
tensorflow (PyPI)from 2.4.0 before 2.4.2, before 20431e9044cf2ad3c0323c34888b192f3289af6b, before 2.2.0rc0, from 2.2.0 before 2.3.0rc0, from 2.3.0 before 2.3.4, from 2.4.0 before 2.4.3GitHub Advisory Database, PyPA Advisory Database
tensorflow-cpu (PyPI)from 2.4.0 before 2.4.2, before 20431e9044cf2ad3c0323c34888b192f3289af6b, before 2.2.0rc0, from 2.2.0 before 2.3.0rc0, from 2.3.0 before 2.3.4, from 2.4.0 before 2.4.3GitHub Advisory Database, PyPA Advisory Database
tensorflow-gpu (PyPI)from 2.4.0 before 2.4.2, before 20431e9044cf2ad3c0323c34888b192f3289af6b, before 2.2.0rc0, from 2.2.0 before 2.3.0rc0, from 2.3.0 before 2.3.4, from 2.4.0 before 2.4.3GitHub Advisory Database, PyPA Advisory Database
google tensorflowfrom 2.4.0 before 2.4.2NVD
tensorflow (Bitnami)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. An attacker can trigger a denial of service via a `CHECK`-fail in `tf.raw_ops.QuantizeAndDequantizeV4Grad`. This is because the implementation does not validate the rank of the `input_*` tensors. In turn, this results in the tensors being passes as they are to `QuantizeAndDequantizePerChannelGradientImpl`. However, the `vec<T>` method, requires the rank to 1 and triggers a `CHECK` failure otherwise. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2 as this is the only other affected version.

GitHub Advisory Database
Impact

An attacker can trigger a denial of service via a CHECK-fail in tf.raw_ops.QuantizeAndDequantizeV4Grad:

import tensorflow as tf

gradient_tensor = tf.constant([0.0], shape=[1])
input_tensor = tf.constant([0.0], shape=[1])
input_min = tf.constant([[0.0]], shape=[1, 1])
input_max = tf.constant([[0.0]], shape=[1, 1])

tf.raw_ops.QuantizeAndDequantizeV4Grad(
  gradients=gradient_tensor, input=input_tensor,
  input_min=input_min, input_max=input_max, axis=0)

This is because the implementation does not validate the rank of the input_* tensors. In turn, this results in the tensors being passes as they are to QuantizeAndDequantizePerChannelGradientImpl:

template <typename Device, typename T>
struct QuantizeAndDequantizePerChannelGradientImpl {
  static void Compute(const Device& d,
                      typename TTypes<T, 3>::ConstTensor gradient,
                      typename TTypes<T, 3>::ConstTensor input,
                      const Tensor* input_min_tensor,
                      const Tensor* input_max_tensor,
                      typename TTypes<T, 3>::Tensor input_backprop,
                      typename TTypes<T>::Flat input_min_backprop,
                      typename TTypes<T>::Flat input_max_backprop) {
    ...
    auto input_min = input_min_tensor->vec<T>();
    auto input_max = input_max_tensor->vec<T>();
    ...
}

However, the vec<T> method, requires the rank to 1 and triggers a CHECK failure otherwise.

Patches

We have patched the issue in GitHub commit 20431e9044cf2ad3c0323c34888b192f3289af6b.

The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2 as this is the only other affected version.

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;Un atacante puede desencadenar una denegación de servicio por medio de "CHECK" en "tf.raw_ops.QuantizeAndDequantizeV4Grad".&#xa0;Esto es debido a que la implementación (https://github.com/tensorflow/tensorflow/blob/95078c145b5a7a43ee046144005f733092756ab5/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L162-L163) no comprueba el rango de los tensores "input_ *".&#xa0;A su vez, esto resulta en que los tensores pasen tal como están a "QuantizeAndDequantizePerChannelGradientImpl" (https://github.com/tensorflow/tensorflow/blob/95078c145b5a7a43ee046144005f733092756ab5/tensorflow/core/kernels/quantize_and_op. Sin embargo, el método "vec(T)" requiere el rango de 1 y, de lo contrario, desencadena un fallo "CHECK".&#xa0;La corrección será incluida en TensorFlow versión 2.5.0.También seleccionaremos este commit 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 compatible

PyPA Advisory Database

TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger a denial of service via a CHECK-fail in tf.raw_ops.QuantizeAndDequantizeV4Grad. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/95078c145b5a7a43ee046144005f733092756ab5/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L162-L163) does not validate the rank of the input_* tensors. In turn, this results in the tensors being passes as they are to QuantizeAndDequantizePerChannelGradientImpl(https://github.com/tensorflow/tensorflow/blob/95078c145b5a7a43ee046144005f733092756ab5/tensorflow/core/kernels/quantize_and_dequantize_op.h#L295-L306). However, the vec<T> method, requires the rank to 1 and triggers a CHECK failure otherwise. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2 as this is the only other affected version.

References

https://github.com/tensorflow/tensorflow/security/advisories/GHSA-6g85-3hm8-83f9advisory, exploit, patch, third-party-advisory, web
https://github.com/tensorflow/tensorflow/commit/20431e9044cf2ad3c0323c34888b192f3289af6badvisory, fix, patch, third-party-advisory, web
https://github.com/tensorflow/tensorflow/blob/95078c145b5a7a43ee046144005f733092756ab5/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L162-L163web
https://github.com/tensorflow/tensorflow/blob/95078c145b5a7a43ee046144005f733092756ab5/tensorflow/core/kernels/quantize_and_dequantize_op.h#L295-L306web
https://nvd.nist.gov/vuln/detail/CVE-2021-29544advisory, web
https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-472.yamlweb
https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-670.yamlweb
https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-181.yamlweb
https://github.com/tensorflow/tensorflowpackage

Sources

SourceRecordLicence
CVE ListCVE-2021-29544 changed 2024-10-31CVE Terms of Use
GitHub Advisory DatabaseGHSA-6g85-3hm8-83f9 changed 2026-07-08CC-BY-4.0
NVDCVE-2021-29544 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2021-181 changed 2023-12-06CC-BY-4.0
PyPA Advisory DatabasePYSEC-2021-472 changed 2023-12-06CC-BY-4.0
PyPA Advisory DatabasePYSEC-2021-670 changed 2023-12-06CC-BY-4.0
Bitnami Vulnerability DatabaseBIT-TENSORFLOW-2021-29544 changed 2026-09-08Apache-2.0