GHSA-388M-835F-7723
Basic auth header overrides REMOTE_USER and other values set with the env directive
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:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-388M-835F-7723 divulgada · CVSS 6.8 (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
Values set with the `env` subdirective of `php_server`/`php` (or `frankenphp.WithRequestEnv()` in the library) are documented to take priority over the variables FrankenPHP populates automatically. Since 1.12.0, five variables are registered after the `env` values and replace them: `REMOTE_USER`, `CONTENT_TYPE`, `PATH_TRANSLATED`, `QUERY_STRING` and `REQUEST_METHOD`.
A common setup authenticates users in Caddy (`forward_auth`, mTLS, an auth plugin) and passes the verified identity to PHP with `env REMOTE_USER {http.auth.user.id}` or a similar placeholder. On affected versions, a client sending its own `Authorization: Basic` header replaces `$_SERVER['REMOTE_USER']` with an arbitrary, unverified user name. Applications that trust `$_SERVER['REMOTE_USER']` can then be accessed as any user.
Deployments that do not set any of the five variables with `env` are not affected.
Patches
Fixed in 1.13.5.
Workarounds
Pass the verified identity to PHP under a name FrankenPHP does not populate itself (for example `env AUTH_USER_ID {http.auth.user.id}`) and read that variable in the application, or strip the `Authorization` header before it reaches `php_server` when the application does not use it (`request_header -Authorization`).
Details
`go_register_server_variables()` merged the prepared environment at the end of its own work, but its C caller `frankenphp_register_variables()` then called `frankenphp_register_variables_from_request_info()`, which writes `CONTENT_TYPE`, `PATH_TRANSLATED`, `QUERY_STRING`, `REMOTE_USER` (from `SG(request_info).auth_user`, decoded by PHP from the `Authorization` header without any check) and `REQUEST_METHOD` with `zend_hash_update`. The ordering was introduced in 1.12.0 by a refactoring of the CGI variable registration.
The fix merges the prepared environment as the last step of `frankenphp_register_variables()`.
`PHP_AUTH_USER`, `PHP_AUTH_PW` and `PHP_AUTH_DIGEST` are registered by PHP itself after the SAPI variables, from the `Authorization` header, so `env` cannot override them (as with php-fpm). Don't use these names to pass a verified identity.
Proof of concept
example.com {
tls {
client_auth {
mode require_and_verify
trust_pool file /etc/caddy/client-ca.pem
}
}
php_server {
env REMOTE_USER {http.request.tls.client.subject}
}
}<?php
echo $_SERVER['REMOTE_USER'];A client holding a valid certificate for `CN=alice` sends:
curl --cert alice.pem --key alice.key -u admin:x https://example.com/index.phpAffected versions print `admin`; patched versions print `CN=alice`.
Credits
Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-FWNWEGEQ.
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-388m-835f-7723Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
