llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Packagist · php-standard-library/filesystem

GHSA-Q8CP-XQ93-R9JR

Filesystem create_temporary_file() creates files non-exclusively and with default permissions, exposing their contents to other local users

Texto original en inglés · Ver en español

Parche disponible
Descargar PNG JSON
CVSS 3.1
5.5
Media
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versión6.4.0
Exposición24 dDesde la divulgación, 27 oct 2026, 8:46 p. m.
Detección22 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir
Remediar en la ventana regular de mantenimiento
Estimación de Llama con el árbol SSVC de CISA a partir de vector CVSS 3.1 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Riesgo con buenos modales, atiéndela con calma.Ponle etiqueta y a la cola. Ordenadito.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
28 oct 26
19 nov 26
21 nov 26
28 oct 26
3 nov 26
9 nov 26
15 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-Q8CP-XQ93-R9JR divulgada · CVSS 5.5 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

Impact

`Psl\Filesystem\create_temporary_file()` chose a random name in the target directory, by default the system temporary directory, and created the file with `Psl\Filesystem\create_file()`, which calls PHP's `touch()`. This had two consequences:

  • Default permissions. The file was created with mode `0666` minus the process umask, which is `0644` under the common umask of `022`. In a shared directory such as `/tmp`, which `sys_get_temp_dir()` returns on most Linux systems, any other local user could read whatever the application wrote to the file while it existed. The names are not secret, since anyone can list `/tmp`.
  • Non-exclusive creation. `touch()` does not fail when the path already exists, and it follows a symbolic link to create or update the link's target. A local user who had created a file or a symbolic link under the chosen name before the call made the application use a file the attacker controls: an attacker-owned, world-writable file receives the data the application writes, and can be changed before the application reads it back. The name holds 32 random bits in 6.0.0 to 6.3.0 (8 random alphanumeric characters, about 47 bits, in 1.5.0 to 5.5.0, published as `azjezz/psl`), so the attacker has to plant a large number of names and succeeds only with a probability proportional to that number. On Linux, the `fs.protected_symlinks` and `fs.protected_regular` protections that most distributions enable by default stop most of these attempts in sticky directories such as `/tmp`. The 32-bit name space also let two calls in different processes return the same file by accident.

Applications are affected when they run on a host shared with untrusted local users, such as shared hosting, multi-user servers or shared CI runners, call `create_temporary_file()` on a shared directory, and write data to the file that other users must not read or change. The attacker needs a local account on the same host. Single-tenant containers, private directories passed as `$directory`, and per-user temporary directories, such as the per-user `TMPDIR` that macOS sets by default, are not exposed. PSL does not call `create_temporary_file()` itself.

Patches

Fixed in 6.4.0 https://github.com/php-standard-library/php-standard-library/releases/tag/6.4.0.

  • The file is created with `fopen()` mode `x` (`O_CREAT | O_EXCL`), which fails if anything, a symbolic link included, already exists under the name, and a collision is retried with a new name, up to 10 attempts.
  • The random part of the name is 8 random bytes (64 bits) instead of 4.
  • The file is created under a temporary umask of `0077`, and its mode is set to `0600` before the path is returned; if the mode cannot be set, the file is removed and a `RuntimeException` is thrown.

Workarounds

  • Pass a private directory as `$directory`: one owned by the application user with mode `0700`. Other users can then neither read the files nor create names in it, which addresses both issues.
  • Setting `umask(0o077)` around the call makes new files `0600`, but does not make the creation exclusive.
  • PHP's `tempnam()` creates a file exclusively, with mode `0600`, and can be used instead.

References

  • POSIX `open()`, `O_CREAT` and `O_EXCL`: https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html
  • PHP `fopen()`, mode `x`: https://www.php.net/manual/en/function.fopen.php
  • https://github.com/php-standard-library/php-standard-library/releases/tag/6.4.0
Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:L
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:L
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:N
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
6.4/ 10Medio
Vector 6.4 (fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida
php-standard-library/php-standard-library · azjezz/psl≥ 1.5.0 < 6.4.0
php-standard-library/filesystem≥ 6.0.0 < 6.4.0
1.5.0
6.0.0
6.4.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
Packagistphp-standard-library/filesystem
Corregida 6.4.0 — —
Packagistphp-standard-library/php-standard-library
Corregida 6.4.0 — —
Packagistazjezz/psl
Corregida 6.4.0 — —
Versiones corregidas6.4.0
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/php-standard-library/php-standard-library/security/advisories/GHSA-q8cp-xq93-r9jr

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.