GHSA-qc49-hpvq-g2w6 / CVE-2026-129289: PHP-FPM request smuggling through an unread HTTP request body
- Published:
- Fetched:
- Updated:
- Affects:
- php sapi-fpm
https://github.com/php/php-src/security/advisories/GHSA-qc49-hpvq-g2w6 ↗
PHP-FPM request smuggling through an unread HTTP request body ### Summary PHP can fail to discard unread bytes from an HTTP request body before reusing a persistent PHP-FPM or LSAPI connection. In PHP-FPM, an unauthenticated attacker can make those bytes form a separate FastCGI request, bypass front-end routing and execute attacker-controlled PHP code with the privileges of the worker. ### Details FastCGI and LSAPI connections can carry more than one request. Before accepting another request on the same connection, PHP must either consume the previous request body or close the connection. Opening `php://input` creates a request-body stream, but PHP reads its contents lazily. During request shutdown, PHP incorrectly treated the existence of this stream as evidence that the body had already been handled and skipped the normal cleanup that discards unread input. An attacker can combine this behaviour with a malformed `multipart/form-data` body that makes PHP's multipart parser stop at a predictable position. If the application then opens `php://input` without reading it to the end, attacker-controlled body bytes remain in the current backend request. This can occur in request frameworks that create an input stream before routing or authentication, even when the selected endpoint does not use the body. When `FCGI_KEEP_CONN` is enabled, PHP-FPM preserves the connection and starts parsing another FastCGI request. The vulnerable implementation discarded its knowledge that it was still inside an `FCGI_STDIN` record, so a FastCGI message placed at the appropriate body offset was accepted as a new request. The front end never created or authorised this request. The forged request controls FastCGI parameters including `SCRIPT_FILENAME`, `REMOTE_ADDR` and `PHP_ADMIN_VALUE`. If the attacker knows the path of an existing PHP script, they can set `allow_url_include=1` and `auto_prepend_file=php://input`, causing the forged request's own input to be executed as PHP. The changed administrator settings can also remain active for later requests served by the same worker. The shared request-cleanup error also affects LSAPI's persistent request lifecycle, but LSAPI does not use this FastCGI parameter mechanism. The issue was introduced with lazy `php://input` handling in PHP 5.6.0. The fix drains input according to whether the body was fully consumed, independently of whether a `php://input` stream exists. PHP-FPM additionally closes a connection instead of accepting another request when the previous FastCGI input record is incomplete. ### Impact Exploitation requires a front end that enables persistent backend connections and an application path that opens `php://input` without reading it fully. Relevant configurations include nginx with `fastcgi_keep_conn on`, Apache `mod_proxy_fcgi` with `enablereuse=on`, HAProxy FastCGI applications that retain backend connections, and LSAPI. Standard nginx and Apache configurations that close the FastCGI connection after each request are not affected by the de Affected packages: php:sapi-fpm Patched: sapi-fpm 8.2.36, sapi-fpm 8.3.37, sapi-fpm 8.4.28, sapi-fpm 8.5.13