5.5medium
Integer overflow due to conversion to unsigned in TensorFlow
- Severity
- 5.5medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.15% (higher than 2% of CVEs)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-9w2p-5mgw-p94cBIT-TENSORFLOW-2021-37645PYSEC-2021-267PYSEC-2021-558PYSEC-2021-756
Description
TensorFlow is an end-to-end open source platform for machine learning. In affected versions the implementation of `tf.raw_ops.QuantizeAndDequantizeV4Grad` is vulnerable to an integer overflow issue caused by converting a signed integer value to an unsigned one and then allocating memory based on this value. The [implementation](https://github.com/tensorflow/tensorflow/blob/8d72537c6abf5a44103b57b9c2e22c14f5f49698/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L126) uses the `axis` value as the size argument to `absl::InlinedVector` constructor. But, the constructor uses an unsigned type for the argument, so the implicit conversion transforms the negative value to a large integer. We have patched the issue in GitHub commit 96f364a1ca3009f98980021c4b32be5fdcca33a1. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, and TensorFlow 2.4.3, as these are also affected and still in supported range.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| tensorflow tensorflow | >= 2.5.0, < 2.5.1, < 2.4.3 | CVE List |
| tensorflow (PyPI) | before 2.4.3, from 2.5.0 before 2.5.1, before 96f364a1ca3009f98980021c4b32be5fdcca33a1, from 2.3.0 before 2.3.4, from 2.4.0 before 2.4.3 | GitHub Advisory Database, PyPA Advisory Database |
| tensorflow-cpu (PyPI) | before 2.4.3, from 2.5.0 before 2.5.1, before 96f364a1ca3009f98980021c4b32be5fdcca33a1, from 2.3.0 before 2.3.4, from 2.4.0 before 2.4.3 | GitHub Advisory Database, PyPA Advisory Database |
| tensorflow-gpu (PyPI) | before 2.4.3, from 2.5.0 before 2.5.1, before 96f364a1ca3009f98980021c4b32be5fdcca33a1, from 2.3.0 before 2.3.4, from 2.4.0 before 2.4.3 | GitHub Advisory Database, PyPA Advisory Database |
| google tensorflow | from 2.3.0 before 2.3.4, from 2.4.0 before 2.4.3, 2.5.0, 2.6.0 | NVD |
| tensorflow (Bitnami) | from 2.3.0 before 2.3.4, from 2.4.0 before 2.4.3, from 2.5.0 before 2.5.1 | Bitnami Vulnerability Database |
All scores
| GitHub_M | 5.5medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
| GitHub | 5.5medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N |
| NVD | 5.5medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
| NVD | 2.1low CVSS:2.0 | AV:L/AC:L/Au:N/C:N/I:N/A:P |
| Bitnami Vulnerability Database | medium rating |
Classification
What each source says
CVE List
TensorFlow is an end-to-end open source platform for machine learning. In affected versions the implementation of `tf.raw_ops.QuantizeAndDequantizeV4Grad` is vulnerable to an integer overflow issue caused by converting a signed integer value to an unsigned one and then allocating memory based on this value. The [implementation](https://github.com/tensorflow/tensorflow/blob/8d72537c6abf5a44103b57b9c2e22c14f5f49698/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L126) uses the `axis` value as the size argument to `absl::InlinedVector` constructor. But, the constructor uses an unsigned type for the argument, so the implicit conversion transforms the negative value to a large integer. We have patched the issue in GitHub commit 96f364a1ca3009f98980021c4b32be5fdcca33a1. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, and TensorFlow 2.4.3, as these are also affected and still in supported range.
GitHub Advisory Database
Impact
The implementation of tf.raw_ops.QuantizeAndDequantizeV4Grad is vulnerable to an integer overflow issue caused by converting a signed integer value to an unsigned one and then allocating memory based on this value.
import tensorflow as tf
tf.raw_ops.QuantizeAndDequantizeV4Grad(
gradients=[1.0,2.0],
input=[1.0,1.0],
input_min=[0.0],
input_max=[10.0],
axis=-100)
The implementation uses the axis value as the size argument to absl::InlinedVector constructor. But, the constructor uses an unsigned type for the argument, so the implicit conversion transforms the negative value to a large integer.
Patches
We have patched the issue in GitHub commit 96f364a1ca3009f98980021c4b32be5fdcca33a1.
The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, and TensorFlow 2.4.3, 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 members of the Aivul Team from Qihoo 360.
NVD (es)
TensorFlow es una plataforma de código abierto de extremo a extremo para el aprendizaje automático. En las versiones afectadas, la implementación "tf.raw_ops.QuantizeAndDequantizeV4Grad" es vulnerable a un problema de desbordamiento de enteros causado al convertir un valor entero con signo a uno sin signo y la posterior asignación de memoria basada en este valor. La [implementación](https://github.com/tensorflow/tensorflow/blob/8d72537c6abf5a44103b57b9c2e22c14f5f49698/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L126) usa el valor de "axis" como argumento del tamaño del constructor de "absl::InlinedVector". Pero, el constructor usa un tipo sin signo para el argumento, por lo que la conversión implícita transforma el valor negativo en un entero grande. Hemos parcheado el problema en el commit 96f364a1ca3009f98980021c4b32be5fdcca33a1 de GitHub. La corrección será incluida en TensorFlow versión 2.6.0. También seleccionaremos este commit en TensorFlow 2.5.1, y TensorFlow 2.4.3, ya que estos también están afectados y todavía en el rango de soporte.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-37645 changed 2024-08-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-9w2p-5mgw-p94c changed 2026-07-08 | CC-BY-4.0 |
| NVD | CVE-2021-37645 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2021-267 changed 2023-12-06 | CC-BY-4.0 |
| PyPA Advisory Database | PYSEC-2021-558 changed 2023-12-06 | CC-BY-4.0 |
| PyPA Advisory Database | PYSEC-2021-756 changed 2023-12-06 | CC-BY-4.0 |
| Bitnami Vulnerability Database | BIT-TENSORFLOW-2021-37645 changed 2026-09-08 | Apache-2.0 |