GHSA-JVMV-5538-PQPG
Open redirect in the php_server and php-server directory trailing-slash redirect
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-JVMV-5538-PQPG divulgada · CVSS 4.3 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Impact
The `php_server` directive and the `frankenphp php-server` command redirect requests for a directory containing an `index.php` to the same path with a trailing slash. The route decides on the cleaned request path, but the `Location` header echoed the original path as received.
A link such as `https://victim.example//attacker.example/..%2fblog` was answered with `308 Location: //attacker.example/../blog/`, which browsers resolve to `attacker.example`. Leading backslashes (`/%5c...`) and control characters (`/%09/...`) give the same result, as browsers treat `\` as `/` and ignore tabs and newlines.
An attacker can use this to send users who follow a link on the site's host name to a host of their choice. The redirect is permanent and can be cached by browsers. The attacker needs to know the name of a directory below the document root that contains an `index.php` (for example `/wp-admin` on WordPress). Nothing is read or modified on the server, and no header can be injected.
Sites that copied the equivalent configuration shown in the documentation (`redir @canonicalPath {path}/ 308`) are affected in the same way.
Patches
Fixed in 1.13.5.
Workarounds
When using a hand-written configuration, or until upgrading, replace the canonical path redirect with the following, which strips the leading slashes, backslashes and control characters from the path before building the `Location` header:
@canonicalPath {
file {path}/index.php
not path */
vars_regexp canonical {http.request.orig_uri.path} (?s)^[/\\[:cntrl:]]*(.*)$
}
redir @canonicalPath /{re.canonical.1}/ 308Sites using `php_server` can switch to this hand-written route (see the "equivalent configuration" in the documentation) until they upgrade.
Details
The `file` and `path` matchers of the redirect route clean the request path, so `//attacker.example/../blog` is matched as `/blog`, which has an index file and no trailing slash. The `Location` header was built from `{http.request.orig_uri.path}/`, the original path without cleaning.
The fix adds a `vars_regexp` matcher capturing the original path without its leading `/`, `\` and control characters, and builds the `Location` header from this capture, as Caddy's `file_server` does for its own redirect. The crafted request above is now redirected to `/attacker.example/../blog/`, which browsers resolve to `/blog/` on the same origin. The documentation was updated accordingly.
Caddy's `php_fastcgi` directive builds the same route and has the same issue. It is reported to the Caddy project separately.
Proof of concept
:8080 {
root * /srv/app
php_server
}With `/srv/app/blog/index.php` present:
curl -sI http://localhost:8080/blog # Location: /blog/
curl -sI 'http://localhost:8080//example.com/..%2fblog' # Location: //example.com/../blog/Credits
Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-109TAVHY.
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/caddy |
Sin parche | — | — | — |
Arsenal 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-jvmv-5538-pqpgLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
