GHSA-28VM-87FH-3PX5
Use-after-free when an extension passes a zval to Workers.SendMessage()
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-28VM-87FH-3PX5 divulgada · CVSS 3.7 (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
Only custom builds that link a Go extension using the experimental extension workers API are affected, and only if that extension passes a PHP value (an `unsafe.Pointer` to a `zval`) to `Workers.SendMessage()`. Stock binaries and Docker images are not affected.
`SendMessage()` handed the caller's `zval` to the extension worker thread as is. Once the worker's closure returned, `frankenphp_handle_request()` released the value with `zval_ptr_dtor()` on the worker thread, although it never took a reference, and after the calling thread had already been woken up. Each PHP thread has its own Zend heap and refcounts are not atomic, so the value was released once too often, on the wrong heap, while the calling thread could still use it.
Depending on the value and timing, this leads to use-after-free, heap corruption (`zend_mm_heap corrupted`) and a crash of the whole process. If the extension forwards client-controlled data this way, a remote client can trigger it.
Patches
Fixed in 1.13.5.
Workarounds
In the extension, convert the value on the calling thread with `frankenphp.GoValue()` and pass the resulting Go value to `SendMessage()` instead of the `zval` pointer.
Details
`go_frankenphp_worker_handle_request_start()` returned an `unsafe.Pointer` message to the worker unchanged, while other message types were converted with `PHPValue()` on the worker thread. `frankenphp_handle_request()` then destroyed the parameter in both cases.
`SendMessage()` now copies a `zval` message with `GoValue()` while still on the calling thread, and the worker thread always builds its own `zval` with `PHPValue()`, which `frankenphp_handle_request()` owns and releases. Types that `GoValue()` cannot convert, such as objects, now make `SendMessage()` return an error. The container allocated by `PHPValue()` is also freed after use; it was previously leaked for every message.
Proof of concept
An extension function that forwards its argument:
//export_php:function my_queue_push(mixed $data): bool
func my_queue_push(data *C.zval) bool {
_, err := worker.SendMessage(context.Background(), unsafe.Pointer(data), nil)
return err == nil
}Calling `my_queue_push(str_repeat('x', 64))` repeatedly from a PHP script aborts the process with `zend_mm_heap corrupted`.
Credits
Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-TYJNC5MI.
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-28vm-87fh-3px5Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
