CVE-2026-129289
Patch Available.
This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.
Overview
PHP is a general-purpose scripting language used mostly for web development. It runs behind web servers through server APIs such as Apache mod_php and PHP-FPM, and powers content management systems and frameworks such as WordPress, Drupal, Moodle and Laravel. PHP-FPM and LSAPI can serve several requests over one persistent connection from the web server. Before PHP accepts the next request on such a connection, it has to consume the previous request body or close the connection.
An HTTP Request Smuggling vulnerability (CVE-2026-129289) has been identified in how PHP discards unread request body data at request shutdown, which allows an unauthenticated attacker to leave body bytes on a persistent PHP-FPM connection so that they are parsed as a separate FastCGI request. That forged request bypasses the web server's routing and can execute attacker-controlled PHP code with the privileges of the worker. The PHP project tracks this issue as GHSA-qc49-hpvq-g2w6.
Per MITRE CWE-444: The product acts as an intermediary HTTP agent (such as a proxy or firewall) in the data flow between two entities such as a client and server, but it does not interpret malformed HTTP requests or responses in ways that are consistent with how the messages will be processed by those entities that are at the ultimate destination.
This issue affects PHP 5.6.0 and later before 8.2.36, PHP 8.3 before 8.3.37, PHP 8.4 before 8.4.28 and PHP 8.5 before 8.5.13, which includes the End-of-Life release lines PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 and 8.1 through their final releases.
Details
Module Info
- Product: PHP
- Affected packages:
php-src(main/SAPI.c,main/fastcgi.c,sapi/fpm,sapi/litespeed) - Affected versions: >=5.6.0 <8.2.36, >=8.3.0 <8.3.37, >=8.4.0 <8.4.28, >=8.5.0 <8.5.13
- GitHub repository: https://github.com/php/php-src
- Published packages: https://www.php.net/downloads
- Package manager: N/A
- Fixed in:
- OSS PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13
- NES for PHP
Vulnerability Info
This Critical-severity vulnerability is found in PHP 5.6.0 and later before 8.2.36, PHP 8.3 before 8.3.37, PHP 8.4 before 8.4.28 and PHP 8.5 before 8.5.13, which includes the End-of-Life release lines PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 and 8.1 through their final releases. The PHP project scores it 9.2 under CVSS 4.0 (CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N). The PHP project classifies it as CWE-444 and CWE-670.
Opening php://input creates a request body stream, but PHP reads its contents lazily. At request shutdown, sapi_deactivate_module() is meant to read and discard any input the script did not consume. In PHP 8.5.12, the code reads:
if (SG(request_info).request_body) {
SG(request_info).request_body = NULL;
} else if (SG(server_context)) {
if (!SG(post_read)) {
/* make sure we've consumed all request input data */
Because of the else, the existence of the stream is treated as proof that the body was handled, and the drain is skipped. An attacker can combine this 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 bytes remain in the current backend request. Frameworks that create an input stream before routing or authentication can do this even when the selected endpoint does not use the body.
When the web server asks PHP-FPM to keep the connection open (FCGI_KEEP_CONN), PHP-FPM goes on to parse another FastCGI request from it. The vulnerable code dropped its record of still being inside an FCGI_STDIN record, so a FastCGI message placed at the right body offset was accepted as a new request that the web server never created or authorized. The forged request controls FastCGI parameters including SCRIPT_FILENAME, REMOTE_ADDR and PHP_ADMIN_VALUE. With the path of an existing PHP script, an attacker can use PHP_ADMIN_VALUE to make PHP run the forged request's own input as code, and the changed settings can stay active for later requests served by the same worker. The attack uses a single request and needs no memory corruption or race condition.
Exploitation requires a front end that reuses 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 demonstrated attack. For LSAPI, the same cleanup error can leave body bytes on a persistent connection and disrupt later requests, but the advisory does not establish code execution there.
The advisory states that the issue was introduced with lazy php://input handling in PHP 5.6.0. The same shutdown logic is present in the final releases of the End-of-Life PHP 5.6 through 8.1 lines.
The fix drains input whenever the body was not fully read, whether or not a php://input stream exists:
if (SG(request_info).request_body) {
SG(request_info).request_body = NULL;
}
if (SG(server_context)) {
if (!SG(post_read)) {
/* make sure we've consumed all request input data */
PHP-FPM also refuses to accept another request on a connection when the previous FastCGI input record is incomplete:
if (UNEXPECTED(req->in_len != 0)) {
return 0;
}
Mitigation
The PHP project publishes security fixes only for its supported release lines. PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 and 8.1 are End-of-Life and will not receive any public updates to address this issue.
Until an upgrade is possible, disable backend connection reuse on the front end: leave nginx fastcgi_keep_conn off, leave Apache enablereuse off, or configure any other FastCGI front end to close its backend connection after every request. Do not expose PHP-FPM or LSAPI listeners directly to untrusted networks. Reading php://input to the end in every request prevents the demonstrated condition, but error paths and resource exhaustion make it unreliable as the only mitigation.
Users of the affected components should apply one of the following mitigations:
- Upgrade to PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13, or later.
- Leverage a commercial support partner like HeroDevs (NES for PHP) for post-EOL security support.
Credits
- sphl (finder)
- David Korczynski (finder)
- Aviral2642 (finder)
- Jakub Zelenka (remediation)