7.8high
Reference binding to nullptr in unicode encoding in TensorFlow
- Severity
- 7.8high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.17% (higher than 7% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-w74j-v8xh-3w5hBIT-TENSORFLOW-2021-37667PYSEC-2021-289PYSEC-2021-580PYSEC-2021-778
Description
TensorFlow is an end-to-end open source platform for machine learning. In affected versions an attacker can cause undefined behavior via binding a reference to null pointer in `tf.raw_ops.UnicodeEncode`. The [implementation](https://github.com/tensorflow/tensorflow/blob/460e000de3a83278fb00b61a16d161b1964f15f4/tensorflow/core/kernels/unicode_ops.cc#L533-L539) reads the first dimension of the `input_splits` tensor before validating that this tensor is not empty. We have patched the issue in GitHub commit 2e0ee46f1a47675152d3d865797a18358881d7a6. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, 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.0, < 2.4.3, < 2.3.4 | CVE List |
| tensorflow (PyPI) | before 2.3.4, from 2.4.0 before 2.4.3, from 2.5.0 before 2.5.1, before 2e0ee46f1a47675152d3d865797a18358881d7a6, from 2.3.0 before 2.3.4 | GitHub Advisory Database, PyPA Advisory Database |
| tensorflow-cpu (PyPI) | before 2.3.4, from 2.4.0 before 2.4.3, from 2.5.0 before 2.5.1, before 2e0ee46f1a47675152d3d865797a18358881d7a6, from 2.3.0 before 2.3.4 | GitHub Advisory Database, PyPA Advisory Database |
| tensorflow-gpu (PyPI) | before 2.3.4, from 2.4.0 before 2.4.3, from 2.5.0 before 2.5.1, before 2e0ee46f1a47675152d3d865797a18358881d7a6, from 2.3.0 before 2.3.4 | 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 | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| GitHub | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
| NVD | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 4.6medium CVSS:2.0 | AV:L/AC:L/Au:N/C:P/I:P/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. In affected versions an attacker can cause undefined behavior via binding a reference to null pointer in `tf.raw_ops.UnicodeEncode`. The [implementation](https://github.com/tensorflow/tensorflow/blob/460e000de3a83278fb00b61a16d161b1964f15f4/tensorflow/core/kernels/unicode_ops.cc#L533-L539) reads the first dimension of the `input_splits` tensor before validating that this tensor is not empty. We have patched the issue in GitHub commit 2e0ee46f1a47675152d3d865797a18358881d7a6. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, as these are also affected and still in supported range.
GitHub Advisory Database
Impact
An attacker can cause undefined behavior via binding a reference to null pointer in tf.raw_ops.UnicodeEncode:
import tensorflow as tf
from tensorflow.python.ops import gen_string_ops
gen_string_ops.unicode_encode(
input_values=[],
input_splits=[],
output_encoding='UTF-8',
errors='ignore',
replacement_char='a')
The implementation reads the first dimension of the input_splits tensor before validating that this tensor is not empty:
const Tensor& input_splits = context->input(1);
const auto input_splits_flat = input_splits.flat<SPLITS_TYPE>();
TensorShape output_shape({input_splits.dim_size(0) - 1});
Patches
We have patched the issue in GitHub commit 2e0ee46f1a47675152d3d865797a18358881d7a6.
The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.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 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, un atacante puede causar un comportamiento indefinido por medio de la vinculación de una referencia a un puntero null en "tf.raw_ops.UnicodeEncode". La [implementación](https://github.com/tensorflow/tensorflow/blob/460e000de3a83278fb00b61a16d161b1964f15f4/tensorflow/core/kernels/unicode_ops.cc#L533-L539) lee la primera dimensión del tensor "input_splits" antes de comprender que este tensor no está vacío. Hemos parcheado el problema en el commit 2e0ee46f1a47675152d3d865797a18358881d7a6 de GitHub. La corrección será incluida en TensorFlow versión 2.6.0. También seleccionaremos este commit en TensorFlow versión 2.5.1, TensorFlow versión 2.4.3, y TensorFlow versión 2.3.4, ya que estos también están afectados y todavía están en el rango de soporte.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-37667 changed 2024-08-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-w74j-v8xh-3w5h changed 2026-07-08 | CC-BY-4.0 |
| NVD | CVE-2021-37667 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2021-289 changed 2023-12-06 | CC-BY-4.0 |
| PyPA Advisory Database | PYSEC-2021-580 changed 2023-12-06 | CC-BY-4.0 |
| PyPA Advisory Database | PYSEC-2021-778 changed 2023-12-06 | CC-BY-4.0 |
| Bitnami Vulnerability Database | BIT-TENSORFLOW-2021-37667 changed 2026-09-08 | Apache-2.0 |