4.4medium
Write to immutable memory region in TensorFlow
- Severity
- 4.4medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.21% (higher than 12% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-hhvc-g5hv-48c6BIT-TENSORFLOW-2020-26268PYSEC-2020-255PYSEC-2020-299PYSEC-2020-334
Description
In affected versions of TensorFlow the tf.raw_ops.ImmutableConst operation returns a constant tensor created from a memory mapped file which is assumed immutable. However, if the type of the tensor is not an integral type, the operation crashes the Python interpreter as it tries to write to the memory area. If the file is too small, TensorFlow properly returns an error as the memory area has fewer bytes than what is needed for the tensor it creates. However, as soon as there are enough bytes, the above snippet causes a segmentation fault. This is because the allocator used to return the buffer data is not marked as returning an opaque handle since the needed virtual method is not overridden. This is fixed in versions 1.15.5, 2.0.4, 2.1.3, 2.2.2, 2.3.2, and 2.4.0.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| tensorflow tensorflow | < 1.15.5, >= 2.0.0, < 2.0.4, >= 2.1.0, < 2.1.3, >= 2.2.0, < 2.2.2, >= 2.3.0, < 2.3.2 | CVE List |
| tensorflow (PyPI) | before 1.15.5, from 2.0.0 before 2.0.4, from 2.1.0 before 2.1.3, from 2.2.0 before 2.2.2, from 2.3.0 before 2.3.2, before c1e1fc899ad5f8c725dcbb6470069890b5060bc7 | GitHub Advisory Database, PyPA Advisory Database |
| tensorflow-cpu (PyPI) | before 1.15.5, from 2.0.0 before 2.0.4, from 2.1.0 before 2.1.3, from 2.2.0 before 2.2.2, from 2.3.0 before 2.3.2, before c1e1fc899ad5f8c725dcbb6470069890b5060bc7 | GitHub Advisory Database, PyPA Advisory Database |
| tensorflow-gpu (PyPI) | before 1.15.5, from 2.0.0 before 2.0.4, from 2.1.0 before 2.1.3, from 2.2.0 before 2.2.2, from 2.3.0 before 2.3.2, before c1e1fc899ad5f8c725dcbb6470069890b5060bc7 | GitHub Advisory Database, PyPA Advisory Database |
| google tensorflow | before 1.15.5, from 2.0.0 before 2.0.4, from 2.1.0 before 2.1.3, from 2.2.0 before 2.2.2, from 2.3.0 before 2.3.2 | NVD |
| tensorflow (Bitnami) | before 1.15.5, from 2.0.0 before 2.0.4, from 2.1.0 before 2.1.3, from 2.2.0 before 2.2.2, from 2.3.0 before 2.3.2 | Bitnami Vulnerability Database |
All scores
| GitHub_M | 4.4medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L |
| GitHub | 4.4medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N |
| NVD | 4.4medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L |
| NVD | 3.6low CVSS:2.0 | AV:L/AC:L/Au:N/C:N/I:P/A:P |
| Bitnami Vulnerability Database | medium rating |
Classification
What each source says
CVE List
In affected versions of TensorFlow the tf.raw_ops.ImmutableConst operation returns a constant tensor created from a memory mapped file which is assumed immutable. However, if the type of the tensor is not an integral type, the operation crashes the Python interpreter as it tries to write to the memory area. If the file is too small, TensorFlow properly returns an error as the memory area has fewer bytes than what is needed for the tensor it creates. However, as soon as there are enough bytes, the above snippet causes a segmentation fault. This is because the allocator used to return the buffer data is not marked as returning an opaque handle since the needed virtual method is not overridden. This is fixed in versions 1.15.5, 2.0.4, 2.1.3, 2.2.2, 2.3.2, and 2.4.0.
GitHub Advisory Database
Impact
The tf.raw_ops.ImmutableConst operation returns a constant tensor created from a memory mapped file which is assumed immutable. However, if the type of the tensor is not an integral type, the operation crashes the Python interpreter as it tries to write to the memory area:
>>> import tensorflow as tf
>>> with open('/tmp/test.txt','w') as f: f.write('a'*128)
>>> tf.raw_ops.ImmutableConst(dtype=tf.string,shape=2,
memory_region_name='/tmp/test.txt')
If the file is too small, TensorFlow properly returns an error as the memory area has fewer bytes than what is needed for the tensor it creates. However, as soon as there are enough bytes, the above snippet causes a segmentation fault.
This is because the alocator used to return the buffer data is not marked as returning an opaque handle since the needed virtual method is not overriden.
Patches
We have patched the issue in GitHub commit c1e1fc899ad5f8c725dcbb6470069890b5060bc7 and will release TensorFlow 2.4.0 containing the patch. TensorFlow nightly packages after this commit will also have the issue resolved.
Since this issue also impacts TF versions before 2.4, we will patch all releases between 1.15 and 2.3 inclusive.
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)
En las versiones afectadas de TensorFlow, la operación tf.raw_ops.ImmutableConst devuelve un tensor constante creado a partir de un archivo mapeado en memoria que se asume inmutable. Sin embargo, si el tipo de tensor no es un tipo integral, la operación bloquea el intérprete de Python cuando intenta escribir en el área de la memoria. Si el archivo es muy pequeño, TensorFlow devuelve apropiadamente un error ya que el área de la memoria posee menos bytes de los necesarios para el tensor que crea. Sin embargo, tan pronto como haya suficientes bytes, el fragmento anterior causa un fallo de segmentación. Esto es debido a que el asignador usado para devolver los datos del búfer no está marcado como devolviendo un identificador opaco, ya que el método virtual necesario no se anula. Esto es corregido en las versiones 1.15.5, 2.0.4, 2.1.3, 2.2.2, 2.3.2 y 2.4.0.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2020-26268 changed 2024-08-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-hhvc-g5hv-48c6 changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2020-26268 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2020-255 changed 2023-12-06 | CC-BY-4.0 |
| PyPA Advisory Database | PYSEC-2020-299 changed 2023-12-06 | CC-BY-4.0 |
| PyPA Advisory Database | PYSEC-2020-334 changed 2023-12-06 | CC-BY-4.0 |
| Bitnami Vulnerability Database | BIT-TENSORFLOW-2020-26268 changed 2026-09-08 | Apache-2.0 |