GHSA-J99Q-3WR8-XJ43
php_server runs non-PHP files as PHP when no split extension matches the path
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-J99Q-3WR8-XJ43 divulgada · CVSS 7.5 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| 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
`php_server` can execute a file whose name does not end in any configured `split` extension. An attacker who can store a file with a chosen name or in a chosen directory under the document root (an upload, avatar or attachment) can have its contents run as PHP.
The route that sends requests to the `php` handler is a Caddy `path` matcher built from the split extensions (`*.php`, `*.php/*`). The handler then looks for the script with `splitPos()`. When `splitPos()` finds no split, the whole request path is used as the script. Two kinds of path pass the router but make `splitPos()` return no split:
- A `.php` inside a directory name, in the default configuration. `splitPos()` stopped at the first `.php` that did not end a path segment, while `*.php/*` matches a later one. `/uploads/photos.php.php/avatar.jpg` ran `avatar.jpg` as PHP. This trigger was introduced in 1.13.0 by the fix for GHSA-xxjp-cjxr-2x6m.
- Unicode case folding, with a split extension containing `i` or `k` (such as `.inc`). Caddy's path matcher lower-cases with `strings.ToLower`, which maps U+0130 to `i` and U+212A to `k`, while `splitPos()` is ASCII-only. `/uploads/avatar.%C4%B0nc` ran `avatar.İnc`.
- On Windows, a directory whose name ends in a split extension. Caddy's path matcher turns backslashes into slashes and trims trailing dots and spaces from each segment, so `/uploads/photos.php./avatar.jpg` and `/uploads/photos.php%5Cavatar.jpg` were routed to PHP and ran `avatar.jpg`.
With the `php` directive used directly, a request reaching it with a path that contains no split extension also ran that file as PHP. Patched versions refuse it as well.
Patches
Fixed in 1.13.5.
Workarounds
Store uploaded files outside the document root, or serve upload directories with a route that never reaches the `php` handler. Reject directory names containing a split extension, and non-ASCII file names, at upload time. Avoid split extensions containing `i` or `k`.
Details
When `splitPos()` found no split, `splitCgiPath()` used the whole request path as the script. A request whose path matches no split extension is now rejected with a 404 (`ErrInvalidScriptPath`), unless a worker is explicitly assigned to it (worker `match` rules, extension workers). This holds whatever routed the request to the `php` handler, so it doesn't depend on how Caddy's path matcher normalizes paths.
`splitPos()` also skips an occurrence of a split extension that does not end a path segment and keeps looking for a later one, which matches what the `*.php/*` route accepts. `/uploads/photos.php.php/avatar.jpg` now resolves to the script `/uploads/photos.php.php` (a directory, which PHP fails to open, so nothing runs) with `/avatar.jpg` as `PATH_INFO`. A split inside a file name, the case fixed by GHSA-xxjp-cjxr-2x6m, is still refused.
This is a variant of GHSA-g966-83w7-6w38 and GHSA-3g8v-8r37-cgjm.
Proof of concept
Default configuration:
root /srv/app
php_serverStore `<?php echo 'ran as PHP';` as `/srv/app/uploads/photos.php.php/avatar.jpg`, then:
$ curl http://localhost/uploads/photos.php.php/avatar.jpg
ran as PHPUnicode trigger:
root /srv/app
php_server {
split .php .inc
}Store the same content as `/srv/app/uploads/avatar.İnc` (U+0130), then:
$ curl http://localhost/uploads/avatar.%C4%B0nc
ran as PHPCredits
Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-2KBPI7KZ.
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-j99q-3wr8-xj43Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
