PHPAfterShell: who found it, what it does, and how to check and fix your servers

On Thursday 19 November 2026 PHP released 8.5.13, 8.4.28, 8.3.37 and 8.2.36. PHP's changelog lists 18 security fixes in 8.5.13, and PHP 8.6.0 came out the same day with the same fixes. The one with a name is PHPAfterShell, a flaw in the way PHP saves sessions to disk that can end with a stranger running code on your server.
It's the second big PHP security release in a month. October's was PHP2Shell, and one of this month's fixes closes a gap that October's fix left open.
This post covers who found the bugs, what an attacker can do with them, how to tell if you're exposed and how to fix it. Our own view is at the end.
Who found it, and how
PHPAfterShell was found by depthfirst, a security company that builds AI tools for finding bugs. They say it was found by their AI models working with their own researchers, and their researcher Yuhang Wu published the write-up. They reported it to PHP privately in late October, and the details stayed private until the fix came out on 19 November.
depthfirst say October's PHP2Shell fix doesn't touch it. It's a separate flaw.
The other bugs in this post came in from all over. PHP's advisory for the upload progress bug credits seven separate reporters, and the PHP-FPM bug three. PHP had already warned about the upload progress bug on 23 October, with a stopgap, and said the full fix would follow in this release.
What can happen
PHP rates every bug below as critical, at 9.2 out of 10. Here's what each one does.
PHPAfterShell (CVE-2026-126714)
Most PHP sites keep visitor sessions, the bit that remembers you're logged in, in small files on the server. That's PHP's default. When PHP updates one of those files it writes over the old contents instead of replacing the file. If the write gets cut off halfway, you're left with a file that's part new and part old.
depthfirst found a way to cut it off on purpose and shape what's left behind. The next time the site loads that session, PHP rebuilds objects the attacker chose, and that can end with their code running on your server. The easy way in is a PHP feature called upload progress, which writes to the session file before any of your own code runs. It was switched on by default before this release.
PHP's advisory says an attacker needs suitable code in your application to finish the job. depthfirst say their full attack uses code built into PHP itself and doesn't depend on your application. They haven't published it. Treat it as remote code execution.
The PHP-FPM bug (CVE-2026-129289)
PHP-FPM is the part of PHP that runs your site behind nginx or Apache on most modern servers. If the web server keeps its connection to PHP-FPM open between requests, and a page only reads part of what was sent to it, the leftover bytes can be read as a second, forged request. PHP says that can run the attacker's own PHP code. The faulty code has been there since PHP 5.6 in 2014.
The default nginx and Apache setups close the connection after every request, and PHP says those aren't affected by the attack it demonstrated. You're exposed if somebody switched connection reuse on, usually for speed.
The upload progress bug (CVE-2026-115560)
This one also goes through upload progress. If two parts of your setup read and write the same sessions in different formats, an attacker can get PHP to build objects of their choosing. That happens when an application changes how sessions are stored partway through a request, or when several applications share one session folder. The reporters showed it running commands on the October releases, using code from Guzzle and Monolog, two libraries found in a large share of PHP projects.
Two PHP 8.5 bugs (CVE-2026-129474 and CVE-2026-129182)
These only affect PHP 8.5. Both are memory bugs in a feature new in 8.5 that adds a backtrace to fatal errors, and it's on by default. PHP has confirmed the first one can run code on 8.5. Its advisory names Laravel facades and Magento's guest shipping estimate as places where real applications reach the faulty code, then says nobody has shown a full attack on a complete Laravel or Magento install.
The first bug also needs a setting called zend.exception_ignore_args to be off. PHP's recommended production config switches it on, which protects you. The official PHP Docker images ship with no config file at all, so it's off there. We checked. The second bug needs unusual server settings, and PHP says nobody has shown it running code.
The gap October left (CVE-2026-129481)
PHP calls this an incomplete fix for one of the two PHP2Shell bugs, CVE-2026-109619. It affects 8.3, 8.4 and 8.5. PHP says nobody has shown it running code yet. If you patched for PHP2Shell in October, you still need this update.
Is anyone using them yet?
Not that anyone has reported. As of 24 November, none of these bugs is on CISA's list of vulnerabilities known to be used in attacks. PHP's advisories don't mention attacks, Wiz said on 19 November it hadn't seen any, and nobody has published working attack code for PHPAfterShell. For comparison, CISA added both PHP2Shell bugs to that list on 26 October, five days after the fix. Don't wait for that to happen here.
What it affects
| If you're on | You're fixed from |
|---|---|
| PHP 8.6 | 8.6.0, released the same day with the fixes |
| PHP 8.5 | 8.5.13 |
| PHP 8.4 | 8.4.28 |
| PHP 8.3 | 8.3.37 |
| PHP 8.2 | 8.2.36 (8.2 itself stops getting fixes on 31 December 2026) |
| PHP 8.1 or older | No fix from PHP. Some Linux distributions patch their own packages, more on that below. |
• PHPAfterShell and the upload progress bug affect every supported branch. depthfirst say PHPAfterShell only affects sites using PHP's default file-based sessions. Sessions kept in Redis or a database aren't affected.
• The PHP-FPM bug affects every supported branch, but only where the web server keeps connections to PHP-FPM open.
• The two backtrace bugs only affect PHP 8.5. The October gap affects 8.3 and newer.
If you use a product that bundles PHP, such as a hosting control panel or an appliance, check with whoever supplies it.
How to work out if you're vulnerable
Run these on the server. If you don't have a command line, our PHP2Shell post covers checking the version in cPanel, Plesk and WordPress.
1. Check the version your website uses
php -v
systemctl list-units 'php*'The first line gives the command line version. The website can use a different one on the same server, so the second line lists the PHP-FPM services that are running, such as php8.3-fpm.service. Check that one too, using its number:
php-fpm8.3 -vCompare what you get with the table above. If PHP came from your Linux distribution's own packages, the number won't tell you. More on that below.
2. Check the settings that matter
php-fpm8.3 -i | grep -E '^(session.save_handler|session.upload_progress.enabled|zend.exception_ignore_args|fatal_error_backtraces) '•
session.save_handler => filesmeans sessions are kept in files, so PHPAfterShell applies.•
session.upload_progress.enabled => Onmeans the easy way in is open.• On PHP 8.5,
fatal_error_backtraces => Onwithzend.exception_ignore_args => Offmeans the worst of the 8.5 bugs applies.
This shows the server-wide settings. Your PHP-FPM pool files and your application can change them, so treat it as a starting point.
3. Check whether the web server keeps PHP-FPM connections open
On nginx:
sudo nginx -T 2>&1 | sed 's/#.*//' | grep -nE 'fastcgi_keep_conn[[:space:]]+on'On Apache:
sudo grep -rniE 'enablereuse[[:space:]]*=[[:space:]]*on' /etc/apache2 /etc/httpd 2>/dev/nullAny output means connections are being reused, so the PHP-FPM bug applies. No output is what you want. If you use HAProxy or LiteSpeed in front of PHP, check with whoever set it up.
If PHP came from your Linux distribution's own packages
Ubuntu and Debian patch old versions without changing the number. We installed Ubuntu 24.04's fixed package and it still reports PHP 8.3.6. Check the full package version instead:
dpkg -l 'php*' | grep '^ii'These are the fixed packages listed by Ubuntu's and Debian's trackers. You're fixed at these versions or higher.
| Release | Fixed PHP package |
|---|---|
| Ubuntu 26.10 | php8.5 8.5.9-0ubuntu2.2 |
| Ubuntu 26.04 LTS | php8.5 8.5.4-0ubuntu1.6 |
| Ubuntu 24.04 LTS | php8.3 8.3.6-0ubuntu0.24.04.14 |
| Ubuntu 22.04 LTS | php8.1 8.1.2-1ubuntu2.29 |
| Debian 13 | php8.4 8.4.28-1~deb13u1 |
| Debian 12 | php8.2 8.2.36-1~deb12u1 |
One thing on Ubuntu 22.04. It ships PHP 8.1, which PHP itself no longer fixes, but Ubuntu has patched its own 8.1 package. That only applies to Ubuntu's package, not 8.1 installed from anywhere else. If your PHP came from Ondřej Surý's repository instead, the version number does change, so php -v is enough.
How to fix it
Update PHP, then restart it
On Ubuntu or Debian, with your own version number in place of 8.3:
sudo apt-get update
sudo apt-get install --only-upgrade 'php8.3-*' 'libapache2-mod-php8.3'
sudo systemctl restart php8.3-fpm
php-fpm8.3 -vIt will list a few packages it's skipping because they aren't installed. That's fine.
• Restart PHP-FPM, and Apache too if it runs PHP itself. The old code keeps running until you do, and several of these bugs live in those long-running processes.
• If you run PHP in Docker, rebuild your images from an updated base image and redeploy them. Containers that are already running won't change on their own.
• If you use your distribution's own package with automatic security updates switched on, the fix should install itself. Check it has, and restart PHP-FPM to be sure.
• The update switches upload progress off by default. If something on your site used it for an upload progress bar, that will stop. Leave it off unless you need it.
If you can't update yet
Switch upload progress off in the server's config, again with your own version number:
echo 'session.upload_progress.enabled = 0' | sudo tee /etc/php/8.3/fpm/conf.d/99-security.ini
sudo systemctl restart php8.3-fpmIf Apache runs PHP itself, put the same file in /etc/php/8.3/apache2/conf.d/ and restart Apache. It has to go in the server config. PHP says switching it off from your application's code is too late. depthfirst put it well: this removes the easiest path to the flaw, not the flaw itself.
Stop the web server reusing PHP-FPM connections
If step 3 found anything, remove fastcgi_keep_conn on; from your nginx config, or enablereuse=on from your Apache config. Then:
sudo nginx -t
sudo systemctl reload nginxOn Apache, use sudo apachectl configtest and reload Apache instead. Pages may get slightly slower. It closes the PHP-FPM bug until you can update.
On PHP 8.5, switch off backtrace arguments
printf 'zend.exception_ignore_args = 1\nfatal_error_backtraces = 0\n' | sudo tee -a /etc/php/8.5/fpm/conf.d/99-security.ini
sudo systemctl restart php8.5-fpmThe first line closes the worst 8.5 bug and the second closes the other. PHP says changing the command line config alone isn't enough, which is why this goes in the PHP-FPM folder. Error messages will carry less detail.
None of these stopgaps covers everything. The only stopgap PHP gives for the October gap is restarting each PHP-FPM worker after every request, which costs a lot of speed. Update.
If you're on PHP 8.1 or older
PHP won't fix it. Unless you're on Ubuntu 22.04's own package, or paying a vendor for extended support, the stopgaps above are all you've got, and the real fix is moving to a supported version. That can break older code, so it needs testing first. PHP 8.2 joins this list on 31 December, so if you're on 8.2, plan the move now.
Has it already been used against you?
Nobody has reported attacks yet, but these bugs work by upsetting PHP's memory, so crashing PHP-FPM workers are worth a look.
sudo grep -Ei 'signal 11|SIGSEGV|segfault' /var/log/php*fpm*.logCrashes have ordinary causes too. Also look for files in your web folder you don't recognise and admin users nobody created. If you find something, don't delete it yet. Keep the logs and get help.
If somebody else hosts your system
Ask them two things. Has PHP been updated to a fixed version and restarted? Is your site on PHP 8.2 or newer, or on a package that still gets security fixes? You should get a straight answer to both.
Our two cents
This is PHP's second big security release in a month, and it closes a gap October's left open. Last week it was nginx. The pattern is the same each time. Old code nobody had looked at closely, then a pile of reports arriving at once, with AI tools in the mix. depthfirst found PHPAfterShell with AI models working alongside their researchers. Seven people reported the upload progress bug separately. The PHP-FPM bug had been sitting there since 2014.
So the useful question is still how quickly you can patch, and who does it. What we'd add after this one:
• Know which PHP actually serves your site. The command line can say something different.
• Restart after updating. A patched package with PHP-FPM still running the old code is still vulnerable.
• Check what's been switched on for speed. Connection reuse is a performance tweak, and it's what makes the PHP-FPM bug reachable.
• Get off PHP 8.1 and older, and plan your move off 8.2 before 31 December.
Plan for more of these, and make sure patching is somebody's job.
If you're not sure who looks after your PHP, get in touch and we'll take a look.
Sources
Things are moving quickly, so check these for anything newer than this post.
• PHP's security advisories for PHPAfterShell, the PHP-FPM bug, upload progress, the 8.5 bugs (one, two) and the October gap.
• PHP's changelog and supported versions page.
• depthfirst's PHPAfterShell page and write-up, for how the bug works.
• Wiz's write-up on the release.
• CISA's known exploited vulnerabilities list, for whether attacks have started.
• Ubuntu's and Debian's trackers, for the fixed package versions.