Skip to content
~/cynarski.me

PHP 8.5.13: 18 CVEs, seven critical, and what they mean behind a load balancer

17 min read Security

PHP 8.5.13 came out today (19 November 2026). Its changelog lists 18 CVEs: 17 PHP advisories plus an update of the bundled uriparser library. Seven are rated critical (CVSS 4.0 9.2). Most of the critical ones can lead to remote code execution.

It's a follow-up to php2shell in more ways than one:

  • Two are incomplete fixes for CVE-2026-109619. CVE-2026-129182 and CVE-2026-129481 are other ways to reach the same stale-state-after-bailout bug.
  • CVE-2026-115560, the upload-progress serializer bug from my 8 November update, is finally fixed.
  • CVE-2026-129474 only became remotely reachable because of the 8.5.12 fix. That release changed how out-of-memory errors are handled, and the new timing makes this older backtrace bug exploitable.

The advisories list the same fixes in 8.2.36, 8.3.37 and 8.4.28, except for the four bugs that only exist in newer branches (marked below).

1. Update first

Updating is the only complete fix. Everything below only reduces exposure until you can.

  • Restart the FPM master and every worker. Several of these bugs live in state that a worker carries from one request to the next, and the old binary keeps running until you restart.
  • Distribution packages may keep the old version number, so check your vendor's advisory, not just php -v.
  • On a fleet, update every server before you consider yourself done. One unpatched server behind the load balancer is still reachable by every attacker (more on that in section 4).

2. The fixed CVEs

Sorted by severity. "Exposed if" is the condition that has to be true for the bug to matter to you, taken from each advisory.

Critical (CVSS 4.0 9.2)

CVE Component What it is Exposed if
CVE-2026-129289 FPM Request smuggling through an unread request body → RCE The front end reuses FastCGI connections (fastcgi_keep_conn on, Apache enablereuse=on, HAProxy FastCGI) and the app opens php://input without reading it to the end
CVE-2026-129474 Core (8.5 only) Use-after-free in __call()/__callStatic() backtraces → RCE (confirmed) fatal_error_backtraces=1 (the 8.5 default) and zend.exception_ignore_args=0 (PHP's built-in default, but not the php.ini-production one)
CVE-2026-129496 Date Freed timezone cache → crash, RCE shown in FPM and mod_php A warning or deprecation at startup, PHP's error_log writing to a file, and an early diagnostic in a fresh worker (for example going over max_input_vars)
CVE-2026-126714 Session An interrupted write leaves a half-old, half-new session file → RCE via a gadget chain The default files save handler, attacker-influenced session data (upload progress is one route), and a usable gadget chain
CVE-2026-115560 Session Upload progress writes in one serializer format, a reader decodes it in another → RCE (shown with Guzzle and Monolog gadgets) Upload progress enabled, and something reads the same session store with a different session.serialize_handler
CVE-2026-129182 Core (8.5 only) Fatal-error backtrace recreated after shutdown (incomplete php2shell fix) → use-after-free Path-specific INI overrides, plus a diagnostic early in a later request: Apache per-directory config, or a front end that sends PHP_VALUE/PHP_ADMIN_VALUE
CVE-2026-129481 Session (8.3+) Stale script filename after an interrupted session shutdown (incomplete php2shell fix) → use-after-free Native PHP sessions, and a fatal error in a callback during session cleanup

High

CVE Component CVSS 4.0 What it is Exposed if
CVE-2026-129291 FPM 8.8 epoll use-after-free in the FPM master → local privilege escalation to root The attacker already runs PHP code in a worker, catch_workers_output = yes (the official Docker images set this), and the master runs as root
CVE-2026-127960 Standard 8.7 A response header folded over many lines burns CPU → DoS The app fetches URLs an attacker controls (or can redirect) through file_get_contents()/fopen()
CVE-2026-128064 Standard 8.2 HTTPS:// or FTPS:// with an uppercase S silently uses plaintext Such a URL reaches a stream function directly or through a redirect, and someone can watch the network
CVE-2026-128090 Phar 7.7 OpenSSL-signed phar accepted with a keyless SHA-256 "signature" → code execution You run OpenSSL-signed phars and an attacker can replace the archive but not its .pubkey

Medium

CVE Component CVSS 4.0 What it is Exposed if
CVE-2026-129538 CGI 6.9 Out-of-bounds read/write while correcting PATH_INFO → crash, memory leak php-cgi only (FPM and mod_php are not affected), with cgi.fix_pathinfo=1 and unusual path mappings
CVE-2026-129501 DOM (8.4+) 6.3 Double free in the XML serializer → crash saveXml() on an untrusted Dom\XMLDocument or Dom\HTMLDocument
CVE-2026-15353 SOAP 6.3 Four bytes of heap memory leak through a malformed arraySize SOAP endpoints, or SoapClient talking to an untrusted server
CVE-2026-129506 SOAP 6.3 Use-after-free with a DTD entity reference → crash SOAP endpoints parsing untrusted XML, WSDL or schemas
CVE-2026-129438 URI (8.5 only) 6.3 Wrong Uri\Rfc3986\Uri string for ~2 GiB input Untrusted URIs of around 2 GiB reach the new URI API
CVE-2026-129292 FPM 5.3 Stored XSS in the FPM status page The status page is enabled and someone opens ?full&html in a browser

Unrated

  • CVE-2026-48841: integer overflow in uriparser's ComposeQueryEngine, fixed in uriparser 1.0.3. PHP bundles uriparser for Uri\Rfc3986\Uri. There is no PHP advisory or score for it.

3. What to check, and how to close it

For a typical Laravel app on nginx and PHP-FPM, I'd go through them in this order.

Request smuggling (CVE-2026-129289): check nginx first

It's the one I'd worry about most. It needs no memory corruption, no addresses and no race, and it works in a single request. But it only works if PHP-FPM keeps the FastCGI connection open between requests, and nginx's default is to close it. So check whether anyone turned that on:

bash
grep -rnE 'fastcgi_keep_conn|keepalive' /etc/nginx/

An upstream block with keepalive only reuses FastCGI connections together with fastcgi_keep_conn on. Until you've patched, turn that off. The cost is a new TCP connection or socket open per request, which is small next to the PHP request itself:

nginx.conf
location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    try_files $fastcgi_script_name =404;   # only pass scripts that exist

    fastcgi_keep_conn off;                 # CVE-2026-129289 (also the default)
    fastcgi_pass php-fpm;

    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    # Don't add PHP_VALUE / PHP_ADMIN_VALUE here (CVE-2026-129182).
}

For Apache, leave enablereuse off on mod_proxy_fcgi. For HAProxy talking FastCGI directly to FPM, make it close the backend connection after every request.

Reading php://input to the end in your own code helps too, but error paths can still leave it unread, so don't rely on that alone.

How the attack works: a malformed multipart/form-data body makes PHP's parser stop at a predictable offset. If the app then opens php://input without reading it, the rest of the body stays in the connection. On a reused connection, FPM reads those leftover bytes as a new FastCGI request that nginx never sent. The attacker controls all its parameters: SCRIPT_FILENAME, REMOTE_ADDR, and PHP_ADMIN_VALUE, which can set allow_url_include=1 and auto_prepend_file=php://input. Those admin settings stay set for later requests on that worker, so other users' requests can run the attacker's code too.

php.ini

php.ini
; PHP 8.5.13 security release (19 November 2026): interim hardening.
; Updating PHP is the only complete fix; these settings reduce exposure.
; Load them where PHP reads them before parsing a request (php.ini, conf.d or
; php_admin_value in the FPM pool), never from ini_set() or .user.ini.
; Restart the FPM master and every worker afterwards.

; CVE-2026-129474: no arguments in backtraces (php.ini-production default,
; but PHP's built-in default is Off, so set it explicitly).
zend.exception_ignore_args = On

; CVE-2026-129474, CVE-2026-129182 (PHP 8.5): no fatal-error backtraces.
fatal_error_backtraces = Off

; CVE-2026-115560, CVE-2026-126714 (and php2shell): no upload-progress writes.
session.upload_progress.enabled = Off

; CVE-2026-129496: either fix every startup warning/deprecation, or keep PHP's
; error_log off the file-timestamp path. Unset error_log goes to the SAPI
; (FPM's log); syslog also avoids it. A file path, including /proc/self/fd/2,
; does not.
;error_log = syslog

; CVE-2026-129538: only matters for php-cgi (not FPM, not mod_php).
cgi.fix_pathinfo = 0

A few notes on those:

  • zend.exception_ignore_args is On in php.ini-production, but PHP's built-in default is Off. Many Docker images ship no php.ini at all, so check what you actually have: php-fpm -i | grep -E 'exception_ignore_args|fatal_error_backtraces'. That doesn't show php_admin_value overrides in pool files, so check those too. display_errors=0 doesn't help, because the backtrace is built anyway.
  • CVE-2026-129496 needs a diagnostic at startup. The easiest fix is to have none. After restarting FPM, look at the log before any request comes in. A leftover session.sid_length or session.sid_bits_per_character from an old php.ini is a common source, since both were deprecated in 8.4. Then make sure PHP's error_log isn't a file path.
  • Laravel doesn't use PHP's native session module, so CVE-2026-129481 mostly doesn't apply to it. Upload progress is different: it writes session files even if your app never calls session_start(). Keep it off.

PHP-FPM pool

www.conf
; php-fpm.d/www.conf (or zz-overrides.conf, loaded after docker.conf)

; CVE-2026-129291: worker output capture is what makes the epoll
; use-after-free reachable. The official Docker images set it to yes.
; Trade-off: anything the app writes to stderr is discarded, so move logs
; to a file, syslog or a socket first.
catch_workers_output = no

; CVE-2026-129292: keep the status page off any public route, and never
; open ?full&html in a browser until the update is deployed.
;pm.status_path = /fpm-status
;pm.status_listen = 127.0.0.1:9001

; Detection for CVE-2026-129289: FPM logs every request it runs, including
; ones nginx never forwarded. Compare its counts with nginx's access log.
access.log = /proc/self/fd/2
access.format = "%{REMOTE_ADDR}e %m %{SCRIPT_FILENAME}e %s %{mili}dms"
  • catch_workers_output is the one with a real trade-off. In containers, Laravel's stderr log channel goes through it. Turn it off and those logs disappear. Either log somewhere else for a while or patch quickly. Running the FPM master as a non-root user limits CVE-2026-129291 too, but doesn't fix it.
  • The FPM access log is my favourite detection trick for the smuggling bug. A forged request shows up in FPM's log, but never in nginx's. Requests in one log and not the other are worth a look.
  • pm.max_requests = 1 stops CVE-2026-129481 from reaching a second request, but every worker is then a fresh one, which is exactly when CVE-2026-129496 is exploitable. Fix the startup diagnostics before you consider it.

Everything else

  • Outbound HTTP (CVE-2026-127960, CVE-2026-128064): if the app fetches user-supplied URLs (webhooks, link previews, avatar imports), send them through an egress proxy with header limits and an allowlist, and lowercase the scheme before calling stream functions. Disable automatic redirects or check every target yourself, because the plaintext bug also triggers on a redirect. Guzzle with the cURL handler doesn't use PHP's stream wrappers, so those calls aren't affected.
  • Phar (CVE-2026-128090): if you deploy signed phars (deploy tools, self-updating CLIs), keep the .pubkey where the download path can't overwrite it.
  • SOAP and DOM: restrict SOAP endpoints, reject DTDs before the SOAP extension sees them, and use saveHtml() instead of saveXml() on untrusted documents where you can.
  • FPM status page: never route it through the public load balancer. Scrape it locally as JSON, with a consumer that treats every field as untrusted text.

4. Behind a load balancer with several web servers

The typical setup: a load balancer (ALB, HAProxy, ingress-nginx) in front of N web servers or pods, each running nginx and PHP-FPM, sharing a database, Redis and the same secrets. A few things work differently there.

The load balancer won't stop the smuggling

To the load balancer and any WAF in front of it, CVE-2026-129289 looks like one ordinary HTTP request with a slightly broken multipart body. The forged request only exists inside the nginx → FPM connection. It never appears in the load balancer's logs or nginx's access log.

Once it's in, the attacker controls REMOTE_ADDR and every HTTP_* value. That includes X-Forwarded-For, and your app trusts it from the load balancer's address. So any IP allowlist for an admin panel, internal endpoint or health route can be bypassed, along with any route nginx itself blocks. A WAF rule can slow this down, but the payload is just bytes in a body, so don't rely on one.

Each web server has its own FPM pools, so a successful request takes over one worker on one server. The attacker then repeats it until every server is covered. After patching, restart every pool on every server. A worker the attacker poisoned keeps their auto_prepend_file until it's recycled.

Worker-reuse bugs don't care how many servers you have

CVE-2026-129182 and CVE-2026-129481 depend on a worker carrying bad state into a later request, and a poisoned worker from the smuggling bug keeps its forged settings the same way. Spreading requests over 10 servers × 20 workers only means the attacker sends more requests until they land on the right worker. Sticky sessions make it easier: an affinity cookie pins the attacker to one server and its handful of workers.

Note too that the next request on a poisoned worker may not be the attacker's. The memory corruption hits whichever user lands there.

Autoscaling and rolling deploys create fresh workers all the time. For CVE-2026-129496, the vulnerable window is a worker's first request, and every new instance, every pod restart and every pm = ondemand spawn opens one. If startup prints a warning, your autoscaler keeps making new targets.

Shared session stores carry the session bugs across servers

Native PHP sessions behind a round-robin balancer need shared storage: NFS with the files handler, Redis or Memcached. That changes two bugs:

  • CVE-2026-126714 needs the files handler. A shared NFS directory means one interrupted write affects that session on every server. A backend that replaces records atomically (Redis) avoids this particular bug.
  • CVE-2026-115560 needs a writer and a reader using different session.serialize_handler values on the same store. That's what you get during a rolling upgrade, when new servers switch to igbinary while old ones still use php, or when a legacy app and a new one share a Redis database. Keep the serializer identical on every server and process that touches the store, or give each its own store.

One compromised server means the whole fleet

Every server usually has the same database credentials, the same APP_KEY, the same cloud role and the same deploy key. RCE on one worker (CVE-2026-129289, -129474, -129496, the session bugs) gives the attacker the worker's privileges. CVE-2026-129291 can then turn that into root on the server: the official Docker images enable worker output capture, and the FPM master often runs as root. From there it's the shared secrets, not the network, that let them into everything else.

If you see signs of exploitation, patching isn't enough: rotate the secrets as well.

DoS: the load balancer helps the attacker spread it

None of these needs a botnet. They're application-level DoS: a few cheap requests that each take out a lot of capacity.

  • Crashing workers (DOM, SOAP, the use-after-frees, CVE-2026-129496): each crafted request kills a worker. FPM respawns it, but the request in flight returns a 502. The load balancer spreads the crafted requests evenly, so every server gets its share.
  • Health checks can make it worse. An active check on /up keeps passing, so the load balancer keeps sending traffic to a server that's crashing workers. Passive outlier detection (HAProxy, Envoy) does the opposite: it pulls a server out on 5xx errors, the rest take its load, and if the attacker keeps going you can lose servers one by one. I wrote about this pattern in 502s from one pod.
  • Burning CPU (CVE-2026-127960): a malicious server slowly streams folded headers to every outbound fetch it can trigger. With 20 workers per server, 20 concurrent slow responses per server fill the fleet. CPU-based autoscaling then adds servers, and those get filled too. request_terminate_timeout caps how long each one takes.

At the edge, per-IP rate limits on the endpoints that accept bodies, uploads or URLs from users are the cheapest defence. Also look for child … exited on signal 11 (SIGSEGV) in the FPM logs across the fleet: a cluster of them right now is worth investigating.

Risk summary

Risk CVEs What the load balancer setup changes
Remote code execution Demonstrated: 129289, 129474, 129496, 115560. Possible: 126714, 129182, 129481. Tampered phar: 128090 One server compromised means all of them, through shared secrets. Smuggling isn't visible to the load balancer or WAF
Privilege escalation to root 129291 Turns RCE on one worker into root on that server, including official Docker images
Access-control bypass 129289 Forged REMOTE_ADDR / X-Forwarded-For defeats IP allowlists that trust the load balancer
Denial of service 129501, 129506, 129496, 129538, 127960, 129438 Spread evenly across the fleet. Health checks can either keep sending traffic to a bad server or pull servers out until too few are left
Information disclosure 128064, 15353, 129538 Plaintext service-to-service calls on the internal network. Memory leaks through SOAP or CGI
XSS on operators 129292 Fleet dashboards that open every server's status page in a browser

5. Checklist

  • PHP updated to 8.5.13 / 8.4.28 / 8.3.37 / 8.2.36 on every server, image and cron host, with all workers restarted
  • No fastcgi_keep_conn on / enablereuse=on / FastCGI connection reuse in HAProxy until patched
  • zend.exception_ignore_args = On and fatal_error_backtraces = Off, confirmed with php-fpm -i
  • session.upload_progress.enabled = Off everywhere; one session.serialize_handler per session store
  • No startup warnings or deprecations in the FPM log; PHP's error_log isn't a file
  • catch_workers_output = no (or patched) on Docker-based images; FPM master not running as root
  • FPM status page not reachable through the load balancer
  • Outbound fetches of user URLs go through an allowlist or egress proxy
  • FPM logs checked for SIGSEGV clusters, and FPM access logs compared with nginx's

6. Personal notes

This part is opinion, not advice. After two big security releases in a month, I've been thinking about where these bugs come from.

Most of this list is the same kind of bug

Count them: use-after-free in the backtraces, the timezone cache, the FPM master, SOAP and the session shutdown; a double free in DOM; an out-of-bounds read and write in CGI; two integer problems in URI handling. Around ten of the 18 CVEs are memory-safety bugs in C, and almost every critical one ends in memory corruption. That's not a dig at the people who maintain php-src. It's what a 30-year-old C codebase of this size looks like when people start fuzzing it seriously.

Would a rewrite in Rust fix it?

It would remove that class of bug, and that's most of this release. It would not fix the rest:

  • The smuggling bug (CVE-2026-129289) is a protocol logic bug. A parser in Rust can stop at the same offset and leave the same bytes in the connection.
  • Uppercase HTTPS:// going out as plaintext, the phar "signature" without a key, the serializer mismatch and the XSS in the status page are all logic bugs that compile happily in any language.

And a full rewrite isn't realistic. The Zend engine, a hundred-odd bundled and PECL extensions, and an extension ABI that half the ecosystem depends on. Every rewrite I've seen of a project that size either stalled or shipped its own new bugs. What I would like to see is what Firefox and the Linux kernel did: new and risky components written in Rust, behind the same C interface. A URI parser, a multipart parser, a FastCGI parser and the session serializers are small, self-contained, take untrusted input and keep showing up in advisories. That's exactly where it pays off.

Should PHP ship its own web server?

The worst bug in this release lives in the seam between nginx and PHP-FPM. FastCGI is a second protocol, parsed by a second implementation, and that's where request smuggling and PHP_VALUE injection come from. If PHP shipped a production-grade HTTP server as part of the package (not php -S, which is for development only), that whole layer would go away.

We're halfway there already. FrankenPHP runs PHP inside Caddy and is now under the PHP Foundation. Laravel Octane runs on it, as well as on RoadRunner and Swoole. But I'm not convinced it would make this list shorter:

  • The HTTP parser becomes PHP's problem. Smuggling between the load balancer and PHP is still possible, just one layer up.
  • Worker mode keeps state across requests on purpose. Half of this release is about state that leaks from one request into the next. In a long-running worker that's not an edge case, it's the design.

So I'd take a bundled server written in a memory-safe language (FrankenPHP's Go and Caddy, for example) over FastCGI any day, but I'd run it in classic mode, where every request starts clean, rather than worker mode for a while yet.

What compilers can do in the meantime

Until anyone rewrites anything, the compiler and the runtime can catch some of this:

  • Hardened builds. _FORTIFY_SOURCE=3, stack protector, full RELRO and PIE, or simply GCC 14's -fhardened. Most distributions build PHP like this already; a php you compiled yourself in a Dockerfile might not. Check your binary with checksec or hardening-check.
  • PHP's own allocator gets in the way. The Zend memory manager hands out memory from its own chunks, so hardened malloc implementations never see most allocations. USE_ZEND_ALLOC=0 switches to the system allocator. It's slower, but it's how you run PHP under AddressSanitizer, and it's worth knowing about.
  • Fuzzing with sanitizers (ASan, UBSan, OSS-Fuzz) is why so many of these bugs were found at all. I'd much rather read 18 CVEs than have them sit unfound.
  • Memory tagging (ARM MTE) and bounds-safety work in Clang turn exactly this kind of use-after-free into a clean crash instead of code execution. It isn't there for most servers yet, but it's the most promising thing on this list.
  • The JIT is a compiler too, and it's more C that generates machine code at runtime. I keep opcache.jit off on anything that doesn't measurably need it. Most Laravel apps wait on the database, not the CPU.

None of this replaces patching. But if I had to bet on what makes PHP's security releases shorter over the next five years, I'd bet on Rust in the parsers and better compiler hardening, not on a big rewrite.

Sources