GHSA-H764-4WH7-M7J2
Double free when a worker script ends its loop after a non-form POST request
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-H764-4WH7-M7J2 divulgada · CVSS 3.7 (GitHub) | |
| Remediación | Parche v1.13.4 | github.com/dunglas/frankenphp · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Impact
When a worker script ends its own loop right after serving a `POST` request whose `Content-Type` is not a form (JSON, XML, plain text...), the same pointer is freed twice during shutdown. Symfony Runtime and Laravel Octane end the loop every 500 requests by default, and an unauthenticated client can make this likely by sending only JSON `POST` requests.
With PHP's default allocator, no visible effect was observed. With `USE_ZEND_ALLOC=0` (used with some profilers and memory debuggers), the system allocator detects the double free and aborts the whole process.
Restarts handled by FrankenPHP (`max_requests`, graceful shutdown, file watcher, admin API) are not affected. Classic mode is not affected.
Patches
Fixed in 1.13.4 by https://github.com/php/frankenphp/commit/8777cc2e5c872ebb869fa2b5f972a913648621e8.
Workarounds
Don't run worker mode with `USE_ZEND_ALLOC=0`, or use FrankenPHP's `max_requests` option instead of ending the loop in the worker script.
Details
PHP's `sapi_deactivate()` frees `SG(request_info).content_type_dup` and `current_user` without clearing the pointers. FrankenPHP calls it after each worker request, and `php_request_shutdown()` calls it again when the worker script returns, without a new request in between. For form requests PHP clears `content_type_dup` itself, which is why only other content types trigger the issue. FrankenPHP now clears both pointers after each worker request, as php-src does starting with PHP 8.6.
Proof of concept
<?php
$loops = 0;
do {
$ret = frankenphp_handle_request(static fn () => print('ok'));
} while ($ret && ++$loops < 2);Send two `POST` requests with `Content-Type: application/json`. ASan reports `attempting double-free` in `sapi_deactivate_module()` called from `php_request_shutdown()`.
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.4 | 0 d | v1.13.6 no afectada |
v1.13.4Arsenal 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-h764-4wh7-m7j2Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
