2.5low
Heap out of bounds read in `RequantizationRange`
- Severity
- 2.5low CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.20% (higher than 10% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-3h8m-483j-7xxmBIT-TENSORFLOW-2021-29569PYSEC-2021-206PYSEC-2021-497PYSEC-2021-695
Description
TensorFlow is an end-to-end open source platform for machine learning. The implementation of `tf.raw_ops.MaxPoolGradWithArgmax` can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/ac328eaa3870491ababc147822cd04e91a790643/tensorflow/core/kernels/requantization_range_op.cc#L49-L50) assumes that the `input_min` and `input_max` tensors have at least one element, as it accesses the first element in two arrays. If the tensors are empty, `.flat<T>()` is an empty object, backed by an empty array. Hence, accesing even the 0th element is a read outside the bounds. 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 package | Versions | Reported by |
|---|---|---|
| tensorflow tensorflow | < 2.1.4, >= 2.2.0, < 2.2.3, >= 2.3.0, < 2.3.3, >= 2.4.0, < 2.4.2 | CVE 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 ef0c008ee84bad91ec6725ddc42091e19a30cf0e | GitHub 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 ef0c008ee84bad91ec6725ddc42091e19a30cf0e | GitHub 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 ef0c008ee84bad91ec6725ddc42091e19a30cf0e | GitHub Advisory Database, PyPA Advisory Database |
| google tensorflow | 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 | NVD |
| 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.2 | Bitnami Vulnerability Database |
All scores
| GitHub_M | 2.5low CVSS:3.1 | CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L |
| GitHub | 2.5low CVSS:3.1 | CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L |
| GitHub | low CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N |
| NVD | 7.1high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H |
| NVD | 3.6low CVSS:2.0 | AV:L/AC:L/Au:N/C:P/I:N/A:P |
| Bitnami Vulnerability Database | high 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.MaxPoolGradWithArgmax` can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/ac328eaa3870491ababc147822cd04e91a790643/tensorflow/core/kernels/requantization_range_op.cc#L49-L50) assumes that the `input_min` and `input_max` tensors have at least one element, as it accesses the first element in two arrays. If the tensors are empty, `.flat<T>()` is an empty object, backed by an empty array. Hence, accesing even the 0th element is a read outside the bounds. 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.MaxPoolGradWithArgmax can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs:
import tensorflow as tf
input = tf.constant([1], shape=[1], dtype=tf.qint32)
input_max = tf.constant([], dtype=tf.float32)
input_min = tf.constant([], dtype=tf.float32)
tf.raw_ops.RequantizationRange(input=input, input_min=input_min, input_max=input_max)
The implementation assumes that the input_min and input_max tensors have at least one element, as it accesses the first element in two arrays:
const float input_min_float = ctx->input(1).flat<float>()(0);
const float input_max_float = ctx->input(2).flat<float>()(0);
If the tensors are empty, .flat<T>() is an empty object, backed by an empty array. Hence, accesing even the 0th element is a read outside the bounds.
Patches
We have patched the issue in GitHub commit ef0c008ee84bad91ec6725ddc42091e19a30cf0e.
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. La implementación de "tf.raw_ops.MaxPoolGradWithArgmax" puede causar una lectura fuera de límites de los datos asignados a la pila si el atacante suministra entradas especialmente diseñadas. La implementación (https://github.com/tensorflow/tensorflow/blob/ac328eaa3870491ababc147822cd04e91a790643/tensorflow/core/kernels/requantization_range_op.cc#L49-L50) asume que los tensores "input_min" y" input_max" tienen al menos un elemento, a medida que accede al primer elemento en dos matrices. Si los tensores están vacíos, ".flat (T) ()" es un objeto vacío, respaldado por una matriz vacía. Por lo tanto, acceder incluso al elemento 0 es una lectura fuera de límites. La corrección será incluida en TensorFlow versión 2.5.0. También seleccionaremos este commit en TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 y TensorFlow 2.1.4
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-29569 changed 2024-08-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-3h8m-483j-7xxm changed 2026-07-08 | CC-BY-4.0 |
| NVD | CVE-2021-29569 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2021-206 changed 2023-12-06 | CC-BY-4.0 |
| PyPA Advisory Database | PYSEC-2021-497 changed 2023-12-06 | CC-BY-4.0 |
| PyPA Advisory Database | PYSEC-2021-695 changed 2023-12-06 | CC-BY-4.0 |
| Bitnami Vulnerability Database | BIT-TENSORFLOW-2021-29569 changed 2026-09-08 | Apache-2.0 |