GHSA-J2F3-WXF2-8QGV
Embedded app directory removed on reload can be recreated by other local users
Texto original en inglés · Ver en español
CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-J2F3-WXF2-8QGV divulgada · CVSS 6.7 (GitHub) | |
| Remediación | Parche v1.13.5 | github.com/dunglas/frankenphp · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Impact
This is an incomplete fix of GHSA-6q3j-62j9-f9hh.
Binaries embedding a PHP application extract it to `<temp dir>/frankenphp_<euid>_<checksum>`. Since 1.13.2, this directory is created with mode `0700` and an existing one is only reused if the current user owns it. This check runs once, when the process starts.
`Shutdown()` deleted the directory. It runs on every Caddy configuration reload, which restarts PHP in the same process, and when any long-running server process of the same binary and user (`run`, `php-server`) stops. The server still running kept serving PHP files from the deleted path. Any local user able to write to the shared temp directory could then recreate it and get PHP code of their choice executed as the account running the binary.
The attacker cannot trigger the removal and has to wait for a reload or for another process of the binary to stop. Setups using a private temp directory (`PrivateTmp=true`, single-user containers) are not affected. After a reload, affected sites also answered 404 until the directory was recreated.
Patches
Fixed in 1.13.5. Programs using the library without Caddy that set `EmbeddedAppPath` at build time and relied on `Shutdown()` to remove it must now call `frankenphp.RemoveEmbeddedApp()` at process exit. The default directory is kept in the temporary directory across runs. A build-time `EmbeddedAppPath` is still removed when the process exits, so it must not be shared by several processes.
Workarounds
Run the service with a private temp directory (for example `PrivateTmp=true` with systemd), or set `TMPDIR` to a directory only writable by the user running the binary. Avoid configuration reloads, and stop all processes of the binary together.
Details
`shutdown()` in `frankenphp.go` called `os.RemoveAll(EmbeddedAppPath)`. `FrankenPHPApp.Start()` in the Caddy module calls `frankenphp.Shutdown()` then `frankenphp.Init()` on every reload, and `Init()` does not extract the app again. The document root and worker paths kept pointing to the deleted directory. The directory name only depends on the effective user ID and the app checksum, so it is shared by all processes of a binary run by the same user, and visible in a listing of the temp directory.
The default directory is no longer removed: its name includes the checksum of the app, so it never holds another version, and it is already meant to be reused across runs. When `EmbeddedAppPath` is set at build time, the directory is removed by the new `RemoveEmbeddedApp()` function, which the Caddy module calls only when the process exits, so that an upgraded binary does not serve stale files.
Proof of concept
With `my-app` a binary embedding an app with `public/index.php`, run by `svc` (uid 1000) with a Caddyfile containing `php_server`:
svc$ ./my-app run --config Caddyfile
svc$ ./my-app reload --config Caddyfile --force # /tmp/frankenphp_1000_<md5> is removed
attacker$ mkdir -p /tmp/frankenphp_1000_<md5>/public
attacker$ echo '<?php echo posix_geteuid();' > /tmp/frankenphp_1000_<md5>/public/index.php
anyone$ curl http://localhost:8080/ # 1000Credits
Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-OKK6GLE8.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
gogithub.com/dunglas/frankenphp |
Corregida | v1.13.5 | 0 d | v1.13.6 no afectada |
v1.13.5Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/php/frankenphp/security/advisories/GHSA-j2f3-wxf2-8qgvLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
