79% vs 51%: independent neobanks lag on app security. Read the report

Deep Dive

Deep Dive

PHP-FPM Request Smuggling RCE, Fixed in 8.5.13 (CVE-2026-129289)

Unread request bodies let an attacker smuggle a FastCGI request past the front end and run PHP as the worker; fixed in 8.5.13, 8.4.28, 8.3.37 and 8.2.36.

TL;DR

  • PHP-FPM did not discard unread request-body bytes before reusing a FastCGI connection. CVE-2026-129289 lets an attacker place a second FastCGI request in those bytes and run PHP as the worker. The PHP project published the advisory on 2026-11-19.
  • The flaw affects PHP 8.2 through 8.5 before the fixed releases, on deployments whose front end keeps FastCGI connections open and whose application opens php://input without reading it.
  • No public exploit is linked. The Cybersecurity and Infrastructure Security Agency (CISA) records no exploitation or automation, and CVE-2026-129289 is not in the Known Exploited Vulnerabilities (KEV) catalog as of 2026-11-19.
  • Upgrade to PHP 8.5.13, 8.4.28, 8.3.37 or 8.2.36, released on 2026-11-19. If you cannot, disable backend connection reuse, as described in "How do I fix it?".

Am I affected?

You are exposed when PHP-FPM runs an affected branch, the front end keeps the FastCGI connection open, and the application opens php://input without reading it. All of these conditions must hold:

  • Requests reach PHP through PHP-FPM. A CLI-only or mod_php deployment does not use the FastCGI connection that carries the forged request.
  • PHP is 8.2.0 through 8.2.35, 8.3.0 through 8.3.36, 8.4.0 through 8.4.27 or 8.5.0 through 8.5.12.
  • The front end keeps backend connections open. The advisory names nginx with fastcgi_keep_conn on, Apache mod_proxy_fcgi with enablereuse=on, HAProxy FastCGI setups that retain backend connections, and LSAPI.
  • The application opens php://input and does not read it to the end before the request ends. Frameworks that create the input stream before routing or authentication do this.
  • The attacker can send a malformed multipart body that makes the parser stop at a predictable position, and can name an existing PHP script on the server.

LSAPI shares the request-cleanup defect, but the advisory links it to stream desynchronisation and disruption, not to the FastCGI parameter chain that runs code. Standard nginx and Apache configurations that close the FastCGI connection after every request are not affected by the demonstrated PHP-FPM attack. PHP 8.6.0, released on the same day, is outside the affected ranges.

W3Techs reports that PHP is used by 68.1% of all the websites whose server-side programming language it can identify, checked on 2026-11-19. The flaw reaches the PHP-FPM deployments that also keep backend connections open.

Branch Affected versions Fixed version
PHP 8.6 Not affected 8.6.0
PHP 8.5 8.5.0 through 8.5.12 8.5.13
PHP 8.4 8.4.0 through 8.4.27 8.4.28
PHP 8.3 8.3.0 through 8.3.36 8.3.37
PHP 8.2 8.2.0 through 8.2.35 8.2.36
PHP 8.1 and older Out of support by the PHP project No PHP release; check the distribution or the vendor

Check the runtime that serves traffic, not the one in a build file:

php -v
php-fpm -v
php-fpm -i 2>/dev/null | grep -E 'Server API|Loaded Configuration File'
dpkg -l 2>/dev/null | grep -E 'php[0-9.]*-fpm'
rpm -qa 2>/dev/null | grep php-fpm

php-fpm -v prints the version of the FPM binary. php -v can differ when the CLI and FPM packages are on different branches. The Server API line from php-fpm -i reads FPM/FastCGI when the binary is FPM. The package commands show which branch the distribution installed.

Then check whether the front end reuses the backend connection. For nginx:

sudo nginx -T 2>/dev/null | grep -n 'fastcgi_keep_conn'

An empty result means the directive is absent, and nginx uses its default of off. A line with on means nginx asks FPM to keep the connection open. For Apache:

sudo apachectl -M 2>/dev/null | grep proxy_fcgi
sudo apachectl -S 2>/dev/null | grep -i 'fcgi'

Apache mod_proxy_fcgi disables connection reuse by default. Look for enablereuse=on in the ProxyPass configuration. For a container, run the same checks inside the running container:

docker exec <container> php-fpm -v
docker exec <container> php-fpm -i 2>/dev/null | grep 'Server API'

The second condition is application code that opens php://input. A search over the application tree finds the candidates:

grep -R --include='*.php' "php://input" /var/www 2>/dev/null

A hit is a lead, not proof. The application must open the stream without reading it to the end on a path an attacker can reach.

How do I fix it?

Upgrade PHP-FPM to the fixed release for your branch. PHP published 8.5.13, 8.4.28, 8.3.37 and 8.2.36 on 2026-11-19 at 14:00 UTC, and 8.6.0 on the same day.

  1. On Debian or Ubuntu, upgrade every PHP package that serves requests, then restart FPM: bash sudo apt update sudo apt install --only-upgrade php8.5-fpm php8.5-cli sudo systemctl restart php8.5-fpm Add libapache2-mod-php8.5 if Apache serves PHP through mod_php. Replace 8.5 with the branch you run. If the distribution has not published the fixed package yet, wait for its security update and use the workaround until then.
  2. On RHEL, Fedora, AlmaLinux or Rocky Linux, upgrade the PHP packages and restart the service: bash sudo dnf upgrade 'php*' sudo systemctl restart php-fpm
  3. On Alpine, upgrade the PHP packages and restart FPM: bash sudo apk upgrade 'php*' sudo rc-service php-fpm83 restart Replace php-fpm83 with the service name of your branch.
  4. Rebuild and recreate every container from a fixed image. Pulling the image alone does not change the running container.
  5. Confirm the running service with php-fpm -v and php-fpm -i | grep 'Server API'.

The 8.5.13 changelog lists 17 other CVE fixes. Six more are rated CVSS v4.0 9.2 Critical:

  • CVE-2026-129474, a use-after-free in magic method backtraces.
  • CVE-2026-129481, a use-after-free after an interrupted session shutdown.
  • CVE-2026-129496, a timezone cache use-after-free.
  • CVE-2026-126714, partially overwritten session files.
  • CVE-2026-115560, a session serializer mismatch covered in our earlier post.
  • CVE-2026-129182, repopulation of the last_fatal_error_backtrace global after shutdown.

Update to the fixed release even if your front end does not reuse FastCGI connections.

If you cannot upgrade immediately, disable backend connection reuse. The forged request is only parsed as a new request when the front end preserves the connection.

  1. In nginx, leave fastcgi_keep_conn at its default off, and remove any keepalive directive on the FPM upstream. Reload nginx.
  2. In Apache mod_proxy_fcgi, leave enablereuse at its default off on every ProxyPass that targets FPM. Reload Apache.
  3. In HAProxy or another FastCGI front end, close the backend connection after every request.
  4. Do not expose the FPM listener directly to an untrusted network.

The workaround blocks the demonstrated FPM path, but it does not repair the request shutdown logic. It also does not cover the other flaws in the release. Reading php://input to the end in application code reduces the condition. The advisory calls that unreliable alone, because error paths, resource limits and shutdown can end the request early.

What is the root cause?

PHP treated the existence of a php://input stream as proof that the request body had been consumed. Request shutdown therefore skipped the drain that keeps unread bytes out of a reused FastCGI connection. The mistake sits in sapi_deactivate_module() in main/SAPI.c at php-8.5.12, lines 502 to 517:

SAPI_API void sapi_deactivate_module(void)
{
    zend_llist_destroy(&SG(sapi_headers).headers);
    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 */
            char dummy[SAPI_POST_BLOCK_SIZE];
            size_t read_bytes;

            do {
                read_bytes = sapi_read_post_block(dummy, SAPI_POST_BLOCK_SIZE);
            } while (SAPI_POST_BLOCK_SIZE == read_bytes);
        }
    }

request_body is the stream object created when application code calls fopen('php://input', 'r'). Merely opening the stream sets the pointer, while post_read records whether the SAPI actually consumed the body. When the pointer is set, the else if branch never runs, so the drain loop is skipped even when post_read is false. The bytes that the multipart parser did not consume stay in the FastCGI connection.

The FastCGI side kept its own incomplete state. fcgi_read_request() in main/fastcgi.c reset req->in_len at the top of every call. It did not first check whether the previous request was still inside an FCGI_STDIN record:

static int fcgi_read_request(fcgi_request *req)
{
    fcgi_header hdr;
    int len, padding;
    unsigned char buf[FCGI_MAX_LENGTH+8];

    req->keep = 0;
    req->ended = 0;
    req->in_len = 0;
    req->out_hdr = NULL;
    req->out_pos = req->out_buf;

The in_len field is how much of the current STDIN record remains. Resetting it to zero told the parser that no partial record existed, so the next bytes on the connection were read as a fresh FastCGI request.

PHP introduced lazy php://input handling in PHP 5.6.0, and the advisory traces the flaw to that change. The fix commit is e0b8eb8ace3c, authored on 2026-10-29 by Jakub Zelenka.

How is it exploited?

An attacker sends one HTTP request and uses the bytes the application leaves behind as a second request to PHP-FPM. The steps are:

  1. Send a POST request with Content-Type: multipart/form-data and a body crafted so the multipart parser stops at a predictable position, before the end of the body.
  2. Reach an application path that opens php://input and does not read the stream to the end. The framework may create the stream before routing or authentication, even when the selected endpoint never uses the body.
  3. Let the request finish. sapi_deactivate_module() sees request_body set and skips the drain, so the unread bytes remain in the connection.
  4. The front end keeps the FastCGI connection open because FCGI_KEEP_CONN is set. FPM reads the remaining bytes as the start of another request.
  5. The attacker's bytes form FastCGI BEGIN_REQUEST, PARAMS and STDIN records. The forged PARAMS set SCRIPT_FILENAME to an existing PHP script, REMOTE_ADDR to a value of the attacker's choice, and PHP_ADMIN_VALUE to allow_url_include=1 and auto_prepend_file=php://input.
  6. FPM accepts the forged request. The front end never created it and never applied its routing or authentication rules to it.
  7. The forged request's own input is included as PHP and runs with the privileges of the FPM worker. PHP settings set through PHP_ADMIN_VALUE can remain active for later requests served by the same worker.

The attack crosses the HTTP-to-PHP backend trust boundary with a single client request. It needs no memory corruption, no memory address leak and no race condition.

How does the attack flow?

A malformed multipart body leaves unread bytes on a kept FastCGI connection, and FPM parses those bytes as a second request that runs attacker PHP.

flowchart LR A["Malformed multipart body"] --> B["App opens php://input without reading it"] B --> C["Request shutdown skips the drain"] C --> D["Unread bytes stay on the kept FastCGI connection"] D --> E["FPM parses a second FastCGI request"] E --> F["Forged SCRIPT_FILENAME and PHP_ADMIN_VALUE"] F --> G["Attacker PHP runs as the worker"]

The missing drain at request shutdown is the step that turns ordinary parser leftovers into a second request.

What can an attacker do?

An attacker who completes the chain runs PHP code as the FPM worker, without another user's interaction and without a non-default PHP setting. The advisory states that impact directly. The forged request can execute attacker-controlled PHP. The attacker does not need application-level code execution or control of PHP_VALUE or PHP_ADMIN_VALUE before the attack.

The same forged request can do more than run the attacker's code:

  • Dispatch an existing PHP script that the front end does not expose through its routes.
  • Supply a forged REMOTE_ADDR to application access controls that trust the client address.
  • Set administrator-level PHP settings for later requests handled by the same worker.

Every impact needs the conditions in "Am I affected?":

  • The attacker reaches an application path that opens php://input without consuming it.
  • The front end keeps the FastCGI connection open.
  • The attacker knows a script path on the server.

The advisory does not establish code execution through LSAPI. There, the same cleanup defect can desynchronise the request stream and disrupt later requests.

Why does the fix work?

The patch makes the drain independent of the php://input stream and makes the FastCGI parser refuse a new request while a STDIN record is incomplete.

--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -504,7 +504,8 @@ SAPI_API void sapi_deactivate_module(void)
    zend_llist_destroy(&SG(sapi_headers).headers);
    if (SG(request_info).request_body) {
        SG(request_info).request_body = NULL;
-   } else if (SG(server_context)) {
+   }
+   if (SG(server_context)) {
        if (!SG(post_read)) {
            /* make sure we've consumed all request input data */
            char dummy[SAPI_POST_BLOCK_SIZE];

--- a/main/fastcgi.c
+++ b/main/fastcgi.c
@@ -1039,6 +1039,10 @@ static int fcgi_read_request(fcgi_request *req)
    int len, padding;
    unsigned char buf[FCGI_MAX_LENGTH+8];

+   if (UNEXPECTED(req->in_len != 0)) {
+       return 0;
+   }
+
    req->keep = 0;
    req->ended = 0;
    req->in_len = 0;
@@ -1300,6 +1304,8 @@ void fcgi_close(fcgi_request *req, int force, int destroy)
        req->nodelay = 0;
 #endif
        req->fd = -1;
+       /* a partially read STDIN record does not outlive its connection */
+       req->in_len = 0;

        req->hook.on_close();
    }

Turning the else if into a separate if means PHP drains the request body whenever post_read is false, even when application code opened php://input. The guard in fcgi_read_request() stops FPM from starting a new request while in_len says the previous STDIN record was only partly consumed. Resetting in_len in fcgi_close() keeps a stale count from surviving the connection.

The fix covers the request-shutdown path and the FastCGI parser. LSAPI relies on the drain change rather than the FastCGI guard. The commit adds two regression tests, one for a kept connection and one for a partial STDIN record.

How do I check if I was compromised?

PHP has published no indicators of compromise for CVE-2026-129289, so there is no file name, address or request string to search for. A failed attempt can leave no trace beyond the application's own request logs.

If PHP-FPM access logging is enabled, compare its entries with the front-end access log. A script execution in the FPM log with no matching request in the nginx or Apache log is a lead: the forged request never passed through the front end. Treat a hit as a reason to inspect the worker's process history and the script that ran, not as proof of compromise.

Check whether the worker still runs an affected binary. Also check whether the front end reuses backend connections:

php-fpm -v
sudo nginx -T 2>/dev/null | grep -n 'fastcgi_keep_conn'
sudo apachectl -S 2>/dev/null | grep -i 'fcgi'

Record the FPM worker start time and the package version before and after the upgrade. A worker that predates the upgrade is still running the vulnerable code.

Timeline

  • 2026-10-29: Jakub Zelenka authors fix commit e0b8eb8ace3c, which drains unread request bodies and hardens the FastCGI parser.
  • 2026-11-13: the PHP project reserves CVE-2026-129289.
  • 2026-11-18: PHP pre-announces a security release for 2026-11-19 between 14:00 and 14:30 UTC, with the highest severity CRITICAL.
  • 2026-11-19 14:00 UTC: PHP releases 8.5.13, 8.4.28, 8.3.37 and 8.2.36; 8.6.0 follows at 14:01 UTC.
  • 2026-11-19 14:44 UTC: the PHP project publishes CVE-2026-129289 and advisory GHSA-qc49-hpvq-g2w6.
  • 2026-11-19: no exploitation in the wild and no CISA KEV entry.

The fix was committed 21 days before the fixed releases shipped.

The fix was committed 21 days before PHP shipped the fixed releases
Figure 1: From the fix commit to the fixed releases. Source: PHP advisory, fix commit and CVE record, checked November 19, 2026

FAQ

Does the flaw affect mod_php or the PHP CLI?

No, the demonstrated attack needs a kept FastCGI connection. mod_php and the CLI do not use FastCGI, so the forged-request path does not apply to them. Upgrade anyway, because the same release fixes other critical flaws that do affect them.

Is a default nginx or Apache installation exposed?

No, the common defaults close the backend connection. nginx sets fastcgi_keep_conn off by default, and Apache mod_proxy_fcgi disables connection reuse by default. The attack applies when an operator turns keepalive on, or when a HAProxy FastCGI setup retains backend connections.

Is there a public proof of concept?

No public exploit code is linked from the advisory or the CVE record. The advisory describes a demonstrated chain. CISA's Stakeholder-Specific Vulnerability Categorization (SSVC) assessment records exploitation as "none" and automatable as "no". That assessment does not make the flaw harmless: technical impact is recorded as "total".

Is PHP 8.6.0 affected?

No, 8.6.0 is outside the affected ranges in the advisory. PHP released it on 2026-11-19, the same day as the security releases, and it contains the fix. Applications that can move to 8.6.0 get the correction without staying on an older branch.

What about the other flaws fixed on 2026-11-19?

The 8.5.13 changelog lists 17 other CVE fixes, including six more rated 9.2 Critical. "How do I fix it?" lists them, and it names the session serializer mismatch in CVE-2026-115560 that we covered separately.

Does reading php://input to the end fix the problem?

No, it removes the demonstrated condition but is not a complete fix. The advisory says error paths, resource exhaustion and application shutdown can still end a request with unread input. Upgrade PHP-FPM and, until then, disable backend connection reuse.

Find the PHP versions inside your images with Ostorlab

Ostorlab's software composition analysis and SBOM scanning inventory the PHP runtime and packages inside your images, so you can see which deployments still carry 8.5.12 or earlier before you rebuild them.

References

  • PHP security advisory GHSA-qc49-hpvq-g2w6, "PHP-FPM request smuggling through an unread HTTP request body", published 2026-11-19: https://github.com/php/php-src/security/advisories/GHSA-qc49-hpvq-g2w6 (checked November 19, 2026)
  • CVE-2026-129289 record, PHP CNA, published 2026-11-19: https://www.cve.org/CVERecord?id=CVE-2026-129289 (checked November 19, 2026)
  • Fix commit e0b8eb8ace3c, "Fix GHSA-qc49-hpvq-g2w6: Drain unread request bodies", authored 2026-10-29: https://github.com/php/php-src/commit/e0b8eb8ace3c6301e6d2499a9e4229eef54c5eb2 (checked November 19, 2026)
  • PHP 8.5.13 release announcement, 2026-11-19: https://www.php.net/archive/2026.php#2026-11-19-4 (checked November 19, 2026)
  • PHP 8.5 changelog for 8.5.13, listing the CVE fixes, 2026-11-19: https://www.php.net/ChangeLog-8.php#8.5.13 (checked November 19, 2026)
  • PHP pre-announcement of the 2026-11-19 security release, 2026-11-18: https://www.php.net/archive/2026.php#2026-11-18-1 (checked November 19, 2026)
  • nginx fastcgi_keep_conn directive, default off: https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_keep_conn (checked November 19, 2026)
  • Apache mod_proxy_fcgi documentation, connection reuse disabled by default: https://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html (checked November 19, 2026)
  • CISA Known Exploited Vulnerabilities JSON feed, catalogVersion 2026.11.18: https://raw.githubusercontent.com/cisagov/kev-data/develop/known_exploited_vulnerabilities.json (checked November 19, 2026)
  • W3Techs, PHP usage share: https://w3techs.com/technologies/details/pl-php (checked November 19, 2026)