GHSA-8QCF-V46R-G2MC
Worker mode runs code of a previous request while the next client's output is active
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-8QCF-V46R-G2MC divulgada · CVSS 4.8 (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
In worker mode, some userland code tied to one request ran after the next request had started, with that next client's output and headers active. Output, headers and cookies emitted by that code were sent to the wrong client, and the code could see the previous client's request data.
Three paths were affected:
- Destructors of objects stored in `$_SESSION` ran during the startup of the next request handled by the same thread. A client without any cookie could receive the body output and `Set-Cookie` headers emitted by the previous user's session objects.
- A warning raised while the next request was parsed (for instance a `multipart/form-data` body without boundary, or too many input variables) was passed to the handler registered with `set_error_handler()` while `$_GET`, `$_POST`, `$_COOKIE`, `$_SERVER`, `$_REQUEST` and `$_FILES` still held the previous client's values.
- Objects left in reference cycles were destroyed by a later run of the garbage collector, inside another client's request.
Separately, callbacks registered with `register_shutdown_function()` inside the request handler run when the worker script stops, in the request that stops it (`exit()`, fatal error, timeout). This is the intended worker mode behavior and is now documented.
Exploitation requires an application that stores objects with output-producing destructors in `$_SESSION` or in reference cycles, an error handler that prints request data, or shutdown functions registered per request that write to the response. Classic (non-worker) mode is not affected.
Patches
Fixed in 1.13.5. `$_SESSION` is released while the request's own output is active, and `frankenphp_handle_request()` empties the other superglobals and runs the garbage collector before waiting for the next request. The worker documentation now describes when shutdown functions run.
Workarounds
- Don't store objects with destructors that produce output or set headers in `$_SESSION`.
- Make error handlers registered by the worker script avoid echoing request data.
- Break reference cycles explicitly, or call `gc_collect_cycles()` after each `frankenphp_handle_request()` call.
- Register shutdown functions once, outside the request handler.
- Alternatively, use classic mode.
Details
`frankenphp_worker_request_shutdown()` released only `PS(http_session_vars)`. The `_SESSION` entry of `EG(symbol_table)` kept the array alive until `frankenphp_reset_super_globals()` deleted it, after `php_output_activate()` and `sapi_activate()` had switched output and headers to the next client. The other superglobals were only replaced when reimported in that same function, so any user error handler called while the request was parsed saw the previous values.
`php_request_shutdown()` calls `zend_call_destructors()` before flushing the output. The worker loop skips it, so cyclic garbage of a request stayed in the collector's root buffer until a later collection.
Proof of concept
Worker script, one thread:
<?php
final class User
{
public function __construct(public string $name) {}
public function __destruct()
{
echo "Signed in as {$this->name}\n";
}
}
while (frankenphp_handle_request(static function (): void {
if (isset($_GET['name'])) {
session_start();
$_SESSION['user'] = new User($_GET['name']);
}
echo "page\n";
})) {
}curl 'http://localhost/?name=alice' # page
curl 'http://localhost/' # Signed in as alice, then pageCredits
Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-9R2SVW8L.
Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-RJAGFIR0.
Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-CNFOEEJX.
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-8qcf-v46r-g2mcLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
