Skip to main content

PHP Fixes phpAfterShell and Six Other Critical Flaws

10 min read
Patch PHP on my servers

We find every PHP version you run and move each to 8.5.13, 8.4.28, 8.3.37 or 8.2.36.

PHP 8.5.13, 8.4.28, 8.3.37 and 8.2.36 shipped on November 19 with 17 security fixes. The headline is phpAfterShell, a flaw in PHP's default file sessions that the October releases did not cover. Who is exposed, the stopgaps, and where the fixed builds are.

What Shipped on November 19

On November 19, 2026, the PHP project released 8.5.13, 8.4.28, 8.3.37 and 8.2.36, one release for every supported branch, with fixes for 17 security advisories. Seven are rated critical at 9.2 under CVSS 4.0, four are rated high and six medium. PHP 8.6.0, a new major version, came out the same afternoon.

The release was announced a day in advance, and the fixed builds reached the official Docker images and Debian's security archive within hours. Nothing points to attacks so far. None of the CVEs is in CISA's catalog of exploited vulnerabilities, and the PHP project said in its announcement that the critical issues need either a non-default configuration or an uncommon setup. That holds for most of them. The one to look at first is phpAfterShell, because it lives in PHP's default session storage.

php -v        # the CLI build, which may not be the one serving web traffic
ls /etc/php/  # every PHP version installed on Debian and Ubuntu

phpAfterShell, CVE-2026-126714

The researchers at depthfirst, who also published the NGINX Rift research in May, found this flaw and named it phpAfterShell. It sits in the files session handler, the default, and the code behind it has been there since PHP 4.1.0.

When PHP saves a session, ps_files_write() writes the new data over the existing file without emptying it first. A complete write leaves nothing behind. An interrupted write leaves the start of the new session followed by the tail of the old one. With careful arrangement, bytes that used to sit inside an ordinary string are then read as serialized object data the next time session_start() opens the file. If the application contains a suitable chain of classes, known as a gadget chain, creating those objects can run code as the PHP worker.

PHP's advisory spells out what an attacker needs. They must influence what goes into the session, interrupt the write at a useful point, and have a gadget chain to work with. Session upload progress, which is on by default, gives any remote client a way to put data into a session, and so does an application that stores large user-supplied strings there. For the interruption, the advisory describes a hard memory-limit failure in another thread of a threaded (ZTS) build. depthfirst says it chained the flaw with another of its findings, a path from deserialization to code execution inside PHP itself, so its exploit did not depend on the application's own classes. It has not published that second bug yet.

The fix empties the file before writing and gives up on the write if that fails. An interrupted write can still lose a session, but it can no longer keep the old tail that makes the attack possible. Sessions kept in Redis, Memcached or a database are not touched by this particular defect.

Patching for PHP2Shell in October does not cover it. phpAfterShell is a separate flaw, and 8.5.12, 8.4.27, 8.3.36 and 8.2.35 do not contain the fix.

The Other Six Critical Fixes

CVEWhat it isWhen it appliesStopgap until you upgrade
CVE-2026-115560Session serializer mismatchUpload progress on, plus apps or pools sharing session files with different serialize_handler valuesTurn off upload progress, or use one serializer everywhere
CVE-2026-129289PHP-FPM request smuggling through an unread bodyA front end that keeps FastCGI connections open, and a script that leaves php://input unreadTurn off backend connection reuse
CVE-2026-129496Timezone cache use-after-freeA startup warning, errors logged to a file, and an early warning in a fresh workerFix startup warnings and restart, or log to syslog
CVE-2026-129474Use-after-free in __call() backtracesPHP 8.5 only, with zend.exception_ignore_args=0Set zend.exception_ignore_args=1
CVE-2026-129182Backtrace data left behind after shutdownPHP 8.5 only, a gap in the October fixSet fatal_error_backtraces=0
CVE-2026-129481Use-after-free after an interrupted session shutdownPHP 8.3 and later, a gap in the October fixSet pm.max_requests=1, at a real performance cost

The request smuggling bug has the clearest payoff for an attacker. It can run attacker-controlled PHP code with no help from the application and no unusual PHP setting. It needs a front end that reuses FastCGI connections, though, such as nginx with fastcgi_keep_conn on or Apache with enablereuse=on. Standard nginx and Apache setups close the connection after every request and are not affected, so the question is whether anyone switched keepalive on to save a few milliseconds.

On PHP 8.5, the stock php.ini-production already sets zend.exception_ignore_args=1, which blocks the backtrace attack. A server that started from the production template is covered for that one until it upgrades.

Two of the six close gaps left by October's fix for CVE-2026-109619, which we covered in PHP Patches Two Unauthenticated RCEs. CVE-2026-115560 is the session flaw PHP announced without a patch on October 23, covered in our note at the time, and it now has one.

The Four Rated High

  • CVE-2026-129291, rated 8.8, lets code already running in a PHP-FPM worker reach the privileges of the FPM master, usually root, when a pool has catch_workers_output enabled. Turning that setting off is the stopgap.
  • CVE-2026-127960, rated 8.7, lets a malicious HTTP server tie up PHP workers with a response header folded across a huge number of lines, when the application fetches URLs through file_get_contents() or fopen().
  • CVE-2026-128064, rated 8.2, made PHP's stream functions send data unencrypted when a URL was written as HTTPS:// or FTPS:// with an uppercase S. Lowercasing the scheme avoids it until the upgrade.
  • CVE-2026-128090, rated 7.7, let someone modify an OpenSSL-signed Phar archive and still have it accepted, by downgrading its signature to a plain hash.

The first two also affect PHP 8.1, which has reached end of life and gets no fix. The six medium advisories cover SOAP, DOM serialization on 8.4 and 8.5, PHP-CGI's PATH_INFO handling, an XSS on the FPM status page and URI serialization on 8.5.

One Default Changes

The fix for CVE-2026-115560 switches session upload progress off by default. Few applications rely on it, since most upload progress bars today are measured in the browser, but anything that does will stop reporting progress after the upgrade. An explicit session.upload_progress.enabled = 1 in php.ini or in an FPM pool overrides the new default. PHP's advisory asks you to look for one, because a setting left on years ago brings the attack path straight back.

grep -rn "upload_progress\|save_handler\|serialize_handler" /etc/php/ 2>/dev/null
php -i | grep -E "session.save_handler|session.upload_progress.enabled"

The second line shows the CLI's view. FPM pools can override both settings, which is why the grep over /etc/php comes first.

Checking Your Servers

Start with the PHP version that actually serves web requests, which is often a different build from the CLI. Then find where sessions live. If session.save_handler is files, treat the server as exposed to phpAfterShell. Sessions in Redis, Memcached or a database put it out of scope for that bug, though the other sixteen fixes still apply.

sudo nginx -T 2>/dev/null | grep -n fastcgi_keep_conn
sudo grep -rn "enablereuse" /etc/apache2 /etc/httpd 2>/dev/null
sudo grep -rn "catch_workers_output" /etc/php/ 2>/dev/null
php -i | grep -E "fatal_error_backtraces|exception_ignore_args"   # PHP 8.5

The first two lines answer the request smuggling question, the third the FPM privilege escalation, and the last the two PHP 8.5 backtrace bugs.

Where the Fixed Builds Are

The official Docker php images published 8.2.36, 8.3.37, 8.4.28, 8.5.13 and 8.6.0 tags on November 19. Pull the new tag, rebuild every image that uses PHP as its base, and redeploy, because a running container keeps the PHP it was built with.

Debian moved quickly. Trixie has php8.4 8.4.28-1deb13u1 under DSA-6641-1, and bookworm has php8.2 8.2.36-1deb12u1 under DLA-4916-1, and both were in the security archive index when we checked on the evening of November 19. Ubuntu's tracker rates phpAfterShell as medium priority and still lists its own PHP packages as awaiting triage.

Many Ubuntu servers take PHP from Ondrej Sury's repository instead. On the evening of November 19 its Ubuntu 24.04 index still listed 8.5.12, 8.4.27, 8.3.36 and 8.2.35, so check what apt would actually install before calling a server patched.

apt policy php8.3-fpm               # use the version you run
sudo apt update && sudo apt install --only-upgrade php8.3-fpm
sudo systemctl restart php8.3-fpm

Restart PHP-FPM, or Apache when PHP runs as mod_php, so that no worker keeps the old code. PHP 8.1 and older get none of these fixes. PHP 8.2 receives security fixes only until December 31, 2026, six weeks away, so a server on 8.2 needs both this update and a plan for the next branch.

Until You Can Upgrade

; php.ini, and every FPM pool that sets its own values
session.upload_progress.enabled = 0
; PHP 8.5 only
zend.exception_ignore_args = 1
fatal_error_backtraces = 0

Turning off upload progress removes the easiest route to phpAfterShell and closes CVE-2026-115560. It does not help an application that stores user data in its sessions by itself, so it buys time and nothing more. On the web server side, leave fastcgi_keep_conn and enablereuse at their defaults, which are off. Restart the PHP workers after any of these changes.

PHP 8.6 Arrived the Same Day

The good news of the week is PHP 8.6.0. It brings partial function application, default values for readonly properties, a new Io\Poll API for watching streams, a clamp() function, a \Time\Duration class and a SortDirection enum, and it gets security fixes until December 31, 2030. A new major version is not a security response, though. Patch your current branch now and plan the move to 8.6 with proper testing, the same way you would any upgrade that changes the language.

What This Means for Your Team

For most teams this is a patch for this week, done in order. First come servers with file sessions and upload progress on, then PHP-FPM behind a proxy that keeps connections open, then anything on PHP 8.5. Docker images and Debian already have the fixed builds, and the stopgaps above cover the gap for servers that wait on a slower repository.

If you run PHP across many servers and want every version found, patched and confirmed, our security and compliance work covers exactly that.

Sources

Read how we handle it in Cybersecurity.