CVE explainer

CVE-2026-129481: why PHP2Shell needed a second fix

Short answer

CVE-2026-129481 is a use-after-free in PHP’s session shutdown that PHP describes as an incomplete fix for CVE-2026-109619, one of the two PHP2Shell bugs. It affects PHP 8.3, 8.4 and 8.5, not 8.2. If you’re on 8.3.36, 8.4.27 or 8.5.12, update again to 8.3.37, 8.4.28 or 8.5.13.

On this page

What PHP says about it

PHP published CVE-2026-129481 on 19 November 2026 as advisory GHSA-g3vh-838c-65v7, “Use-after-free after interrupted session shutdown”, rated critical (CVSS 4.0 9.2). The advisory is unusually direct about where it comes from:

This is an incomplete fix for CVE-2026-109619 (GHSA-6wmf-4rv5-p3rp).

CVE-2026-109619 is the second half of PHP2Shell, fixed on 21 October. It’s about state left behind when PHP abandons a request halfway through. The October releases closed the paths that had been reported. CVE-2026-129481 is another path of the same kind, in the session extension, that the October fix didn’t reach.

Is this a PHP2Shell patch bypass?

Not quite, and the difference matters if you’re explaining it to a manager. The October releases still fix what they set out to fix. None of the November advisories says the original PHP2Shell attacks work again on 8.3.36, 8.4.27 or 8.5.12.

What PHP found is a neighbouring hole in the same bug class. It’s rated critical, but the advisory is careful: the use-after-free “could potentially lead to remote code execution”, and code execution through this path has not been demonstrated. Red Hat rates it one step lower, as Important.

So: no panic, but no reason to wait either. The fix ships in the same release as six other critical issues.

Which versions are affected?

Branch Vulnerable Fixed in
8.5 8.5.0 to 8.5.12 8.5.13
8.4 8.4.0 to 8.4.27 8.4.28
8.3 8.3.0 to 8.3.36 8.3.37
8.2 not affected (update to 8.2.36 for the other fixes)
8.6 pre-releases 8.6.0

PHP 8.2 is out of scope because the session field involved was only added in PHP 8.3.0. Debian’s tracker agrees and marks its php8.2 package as not affected. That doesn’t mean 8.2 users can skip the release: 8.2.36 fixes 12 other issues, four of them critical. See the full list.

On Debian 13 (trixie) the fixed package is php8.4 8.4.28-1~deb13u1, from DSA-6641-1. For other platforms, see the patch guides.

What it takes to trigger

When a session starts, PHP 8.3 and later remember the filename of the script that started it. The bug needs three things:

  1. A fatal error inside a callback that runs during session cleanup. The advisory’s example is a user-defined stream wrapper whose stream_close() method hits a fatal error. Running out of memory is the classic fatal error, but any fatal error at that point counts.
  2. The fatal error aborts session shutdown. PHP frees the request’s memory while the worker still holds a pointer to that filename.
  3. A later request lands on the same worker. That’s normal for PHP-FPM and Apache: workers handle many requests in turn. The second request doesn’t need to come from the same user or session.

Debian’s description adds a detail: the filename has to be in request memory, which is the case when the script isn’t cached by OPcache. The advisory’s own reproducer ran PHP-FPM with OPcache disabled.

Most applications never put code that can fatal-error into session cleanup. Custom session handlers and stream wrappers are where to look if you maintain your own framework.

Why the October stopgaps don’t help

If you followed the PHP2Shell advice in October, you probably turned off session upload progress. That doesn’t help here. The advisory says the upload-progress and early-diagnostic conditions from the October advisory are not needed for this path, and that disabling upload progress doesn’t address it.

Turning OPcache on isn’t a reliable fix either, according to the same advisory, even though the reproducer had it off.

Stopgap if you can’t upgrade today

The advisory gives one config-level stopgap for PHP-FPM: make every worker exit after a single request, so there’s never a “later request on the same worker”.

; your FPM pool, e.g. /etc/php/8.3/fpm/pool.d/www.conf
pm.max_requests = 1

Then restart PHP-FPM:

sudo systemctl restart php8.3-fpm

This is expensive. Every request now pays for starting a new worker process. Red Hat calls the performance cost significant, and on a busy site you’ll see it in CPU use and response times. Treat it as a bridge for hours or days, not a setting to keep. Revert it once you’ve upgraded.

The other mitigation is in your code: make sure nothing that runs during session cleanup can hit a fatal error. That’s hard to prove for a large application, which is why upgrading is the real answer.

The other November follow-ups to PHP2Shell

CVE-2026-129481 isn’t the only fix in the 19 November release that traces back to October. Here’s how they relate:

CVE What it is Branches Link to PHP2Shell
CVE-2026-129481 Use-after-free after interrupted session shutdown 8.3, 8.4, 8.5 PHP: incomplete fix for CVE-2026-109619
CVE-2026-129182 Use-after-free via the fatal error backtrace after shutdown 8.5 only PHP: same bug class as CVE-2026-109619
CVE-2026-129474 Use-after-free in magic method backtraces 8.5 only Engine bug in PHP 8.5’s fatal error backtraces
CVE-2026-126714 “phpAfterShell”: partially overwritten session files all supported Separate session bug that the October releases didn’t touch
CVE-2026-115560 Session serializer mismatch all supported Announced two days after PHP2Shell, fixed now

The two PHP 8.5-only bugs are on their own page, phpAfterShell has a full explainer, and CVE-2026-115560 is now fixed too.

How to check you have the fix

Check the PHP that serves the website, not just the CLI. How to find it.

php-fpm8.3 -v

# Distro packages keep older version numbers: look for the CVE ID instead
zgrep CVE-2026-129481 /usr/share/doc/php8.3-common/changelog.Debian.gz
rpm -q --changelog php-common | grep CVE-2026-129481

Then restart. The vulnerable state lives inside long-running workers, so an upgraded package with old workers still running isn’t fixed yet. systemctl restart, not reload, and rebuild any containers.

You can also paste the version into the checker, which knows the November cut-offs.

Was anything exploited?

As of 20 November there were no public reports of this CVE being exploited, and it wasn’t on CISA’s Known Exploited Vulnerabilities list. PHP2Shell itself was exploited in October, so if you were slow to apply that patch, the compromise checklist is still worth an hour.

Rather not do it yourself? We patch and verify one server, from €79.

Shayan Abbas writes these PHP security guides from the official advisories and vendor guidance listed below, and updates them when those change. About this site

Sources

  1. GitHub php-src advisory GHSA-g3vh-838c-65v7: Use-after-free after interrupted session shutdown
  2. php.net: PHP 8.2.36, 8.3.37, 8.4.28 and 8.5.13 released (19 Nov 2026)
  3. php.net: PHP2Shell security advisory (21 Oct 2026)
  4. Debian security tracker: CVE-2026-129481
  5. Red Hat: RHSB-2026-020: Multiple vulnerabilities in PHP
  6. SecurityWeek: PHP patches seven critical RCE vulnerabilities

Know about the next critical PHP bug first

Short, plain-English alerts when a serious PHP vulnerability or fix lands — with what to patch and how. About two emails a month.