How to Fix phpAfterShell (CVE-2026-126714): Patch Guide for WordPress & PHP Sites

How to fix phpAfterShell — patch CVE-2026-126714 in 10 minutes

You patched PHP in October. You did everything right — and your site is still vulnerable.

On November 19, 2026, the PHP project released emergency security updates fixing 17 vulnerabilities, seven of them rated critical at 9.2 out of 10. The headline flaw has a name: phpAfterShell. It lives in PHP’s default session handling, it can let an attacker run code on your server, and the October PHP2Shell patch does not fix it. If your site runs PHP — and PHP runs about 70% of websites, according to W3Techs — this is the most important ten minutes you will spend today.

The good news: learning how to fix phpAfterShell is straightforward. Update PHP to the fixed release for your branch, restart your PHP workers, and verify the version actually serving your traffic. This guide walks you through exactly that — what phpAfterShell is, which versions are affected, how to check your site in under a minute, and how to fix phpAfterShell on shared hosting, a VPS, and WordPress, step by step. Whether you run shared hosting, a VPS, or WordPress, the steps for how to fix phpAfterShell are the same at their core: update, restart, verify.

What Is phpAfterShell?

phpAfterShell is a critical vulnerability in PHP’s default file-based session handler, tracked as CVE-2026-126714 and rated 9.2 (critical) on the CVSS 4.0 scale. It was discovered and reported by the security research company depthfirst, and fixed on November 19, 2026 — the same day it was disclosed.

Here is the plain-English version. PHP remembers who your visitors are with sessions — small chunks of data stored on the server, usually as files. Every time a visitor loads a page, PHP reads their session file, updates it, and writes it back. That write is where phpAfterShell lives. Before we get into how to fix phpAfterShell, it helps to know exactly what you are fixing — because the fix makes more sense once the flaw does.

The danger is not theoretical. With the right conditions, an attacker who never logs in can corrupt a session file so that PHP later treats attacker-chosen data as its own — and then runs code on your server. No password needed, no admin access needed. That is why the flaw scores 9.2 out of 10, and why every PHP site owner needs to know how to fix phpAfterShell now, not next month.

Two things make phpAfterShell especially sneaky. First, it affects PHP’s default configuration — the file-based session handler that most sites use without ever changing a setting. Sites that store sessions in Redis or a database are outside this specific flaw (though PHP advises checking how each store handles an interrupted update). Second, the October PHP2Shell fixes do nothing against it, so sites that patched in October and relaxed are still exposed — and both are reasons the guide below on how to fix phpAfterShell starts with the update, not with settings.

As of November 23, 2026, no exploitation in the wild had been reported, and none of the November vulnerabilities had been added to CISA’s Known Exploited Vulnerabilities catalog. That is good news — but it is also a window, not a guarantee. The researchers published a detailed technical writeup, and the clock on that window is already ticking.

How phpAfterShell Works: A Session File Cut in Half

To understand how to fix phpAfterShell, it helps to see the flaw in one picture: imagine a session file as a single line of text that PHP rewrites on every request. The problem is that PHP rewrites it in place — it writes the new data over the old file using two separate steps (pwrite() followed by ftruncate()), without first emptying the file.

Those two steps are not atomic. If the PHP worker process dies in the middle of the write — killed by an out-of-memory event, a memory limit, or a timeout — the file can end up holding the beginning of the new session data followed by the end of the old data. Both halves are valid on their own. But stitched together, they mean something completely different.

Here is the attack in four steps:

  1. Plant the data. The attacker uses PHP’s session upload progress feature — which records a file upload’s progress in the session before the application’s own code even runs — to shape the data stored in a session file. No login is required, and the target site does not even need an upload form. That unauthenticated entry is the first thing the steps for how to fix phpAfterShell shut down.
  2. Cut the write. The attacker arranges for the PHP worker to die at just the right moment during a session write, leaving a session file that is half new data, half old data.
  3. Wait for the splice. The length fields in the new prefix are chosen so that PHP’s session decoder reads leftover bytes from the old suffix as separate session entries — including serialized objects the attacker chose.
  4. Trigger the code. On the next request, when the application calls session_start(), PHP deserializes those objects. Combined with a suitable deserialization gadget chain in the application — or, as depthfirst demonstrated, a second memory-corruption bug in a PHP-native class — that deserialization becomes remote code execution.

That four-step chain is also why partial fixes fail: blocking only the upload-progress entry point does not repair the file write itself, which is why knowing how to fix phpAfterShell properly means updating PHP rather than tweaking settings.

The fixed releases close the hole at the source: they empty the session file before each write and stop the write if that step fails. That is the whole fix — and it is why updating PHP, rather than any plugin or firewall rule, is the only complete answer to how to fix phpAfterShell.

how to fix phpAfterShell — corrupted PHP session file attack diagram

CVE-2026-115560: The Second Critical Flaw in the Same Release

phpAfterShell is not the only reason to update. The November 19 release also fixes CVE-2026-115560, a second critical session flaw rated 9.2, and it is the one the PHP project had already warned about in October.

CVE-2026-115560 is a session serializer mismatch. PHP supports three ways to serialize session data — php, php_serialize, and php_binary — and they do not share a format. The php format separates each session key from its value with a pipe character (|). If session data is written with one serializer and later read with another, an attacker-controlled pipe inside a key can make PHP treat part of a key as serialized object data.

That mismatch happens when an application switches session.serialize_handler at runtime before calling session_start(), or when separate applications, PHP-FPM pools, virtual hosts, or command-line jobs with different settings share the same session store. The attack path also runs through session upload progress, and the PHP advisory reports that researchers demonstrated command execution with Guzzle and Monolog gadget chains. That shared entry point is why the answer to how to fix phpAfterShell covers both flaws at once.

The practical point is simple: CVE-2026-115560 and phpAfterShell are two different doors into the same room. Patching one without the other leaves your server open, and the November 19 release is the only update that closes both. If you are researching how to fix phpAfterShell, fix both flaws in the same update — they ship together.

Which PHP Versions Are Affected?

Every supported PHP branch from 8.2 to 8.5 is affected, along with the 8.6.0 release candidates. The fix is a small version bump inside your current branch — nobody has to move to PHP 8.6 to get it.

PHP branch Affected versions Fixed version
PHP 8.2 Before 8.2.36 8.2.36
PHP 8.3 Before 8.3.37 8.3.37
PHP 8.4 Before 8.4.28 8.4.28
PHP 8.5 Before 8.5.12 8.5.13
PHP 8.6 Pre-release builds 8.6.0 (includes the fix)

Three warnings matter here. First, PHP 8.1 and older get no fix at all — those branches are end of life, and the PHP project released nothing for them. If your site still runs PHP 8.1 or older, this is the moment to move to a supported branch; about a third of WordPress sites still run PHP 8.1 or older, according to WordPress.org statistics, so check yours rather than assuming.

Second, PHP 8.2 reaches end of life on December 31, 2026 — patch it now, then plan the move to a newer branch. Third, the October fixed versions (8.2.35, 8.3.36, 8.4.27, 8.5.12) do NOT contain this fix. If your version number ends in one of those, you patched PHP2Shell — and you still need the November update. If your branch is listed above, the sections below show how to fix phpAfterShell for your exact setup — but first, check which version you actually run.

One more trap: some Linux distributions and managed hosts backport a security fix while keeping an older-looking version number. Ubuntu, for example, shipped fixed PHP packages for 22.04, 24.04, and 26.04 on November 20, 2026 without changing the upstream number, and Debian fixed bookworm and trixie through its security repositories. If your number looks old but your host or distribution says the fix is in, ask for the exact package revision — the version string alone is not always the whole story, and confirming it is part of how to fix phpAfterShell on distribution-managed servers.

The November 19 Release: 7 Critical Flaws, Not Just One

The November 19, 2026 release fixed 17 vulnerabilities: 7 critical, 4 high, and 6 medium. phpAfterShell is the best known, but it is not the only critical one. Every fix below ships in the same update, so learning how to fix phpAfterShell once covers all seven. Here are the seven critical flaws, all rated CVSS 9.2:

CVE What it is Who should worry most
CVE-2026-126714 phpAfterShell — interrupted session file write leads to RCE Every site using file-based sessions (the PHP default)
CVE-2026-115560 Session serializer mismatch in upload progress leads to RCE Sites that switch session serializers or share a session store
CVE-2026-129289 PHP-FPM request smuggling — unauthenticated RCE PHP-FPM behind a front end that reuses FastCGI connections (nginx fastcgi_keep_conn on, Apache enablereuse=on)
CVE-2026-129182 Use-after-free in PHP core, possible RCE PHP 8.5.0–8.5.12 only
CVE-2026-129474 Use-after-free in call/callStatic backtraces after a fatal error PHP 8.5 only
CVE-2026-129496 Timezone-cache use-after-free Non-thread-safe builds
CVE-2026-129481 Memory corruption / crash bug Same family as the October flaws; code execution not demonstrated

The pattern is worth noticing: several of these flaws need a specific configuration or an uncommon setup, and PHP said so itself. But several others depend on how your application behaves, not on a setting you can check — which is exactly why the PHP project, Cloudflare, and every security vendor covering this release say the same thing: patching is the only way to rule them all out. Knowing how to fix phpAfterShell means updating PHP — there is no configuration shortcut that covers the whole release.

How to Check If Your Site Is Affected

Before you fix anything, find out where you stand — the first step in how to fix phpAfterShell is knowing your exact version. The check takes about a minute, and you need the full version number — “8.3” is not enough, because the fix lives in the third number (8.3.37).

On WordPress: sign in to your dashboard, go to Tools → Site Health → Info, open the Server section, and read the PHP version. Compare it with the table above. If your number is lower than the fixed version for your branch, your site is affected.

On shared hosting: open your control panel — cPanel’s “Select PHP Version” or “MultiPHP Manager”, Plesk’s PHP settings, or your host’s PHP manager — and read the version shown for your domain. Note that control panels often show only “8.3”, so confirm the full number inside WordPress Site Health as well. That full number is what decides how to fix phpAfterShell for your site.

On your own server: run php -v in the terminal. Then check which session handler your web requests actually use, because the command-line version can differ from the one serving web traffic:

php -i | grep -E 'session.save_handler|session.upload_progress.enabled|session.serialize_handler'

If session.save_handler reads files, your site uses the default handler that phpAfterShell targets. If it reads redis or memcached, this specific flaw does not apply to your session store — but update anyway, because the November release fixes six other critical flaws that may.

A real-world example: a small business site we checked was running PHP 8.3.36 — the October fixed version. The owner believed the site was fully patched, because October’s update had gone smoothly. It was not: 8.3.36 predates the phpAfterShell fix by one release, and the site needed 8.3.37. That one-number gap is the single most common mistake right now, and it is exactly why the version check matters more than the feeling of being patched when you work out how to fix phpAfterShell for your own site.

how to fix phpAfterShell — check PHP version in WordPress Site Health

How to Fix phpAfterShell on Shared Hosting

Most small sites run on shared or managed hosting, and for them how to fix phpAfterShell is mostly a conversation with the host — because the host controls the PHP version, not you.

Step 1: Check your version using WordPress Site Health as described above, and note the exact number.

Step 2: Ask your host directly. Most hosts patch PHP for you, but not all do it on the same day, and some wait for you to ask — so asking is often the whole of how to fix phpAfterShell on shared hosting. Send support a message like this:

Hi, my site runs PHP [your version]. Have you applied the November 19, 2026 PHP security updates (phpAfterShell, CVE-2026-126714) to my server? If not, when will the fixed version (8.2.36, 8.3.37, 8.4.28, or 8.5.13) be installed?

Step 3: Switch PHP versions in your panel if your host offers it. cPanel, Plesk, and most managed WordPress hosts let you pick a PHP version per domain. Choose the fixed release for your branch — or a newer supported branch if your host offers one. Either way, this panel switch is how to fix phpAfterShell without touching a terminal.

Step 4: Verify after the change. Recheck Site Health and confirm the new version is actually serving web requests, not just installed somewhere on the server. That verification step is part of how to fix phpAfterShell properly — an installed update that is not serving traffic is not a fix. Then test your site: log in, submit a form, and load a few key pages.

Step 5: If your host cannot or will not update, that is a signal, not a dead end. A host that leaves a 9.2 critical PHP flaw unpatched a week after the fix shipped is a host worth leaving. Move the site to a host that tracks PHP security releases — and if you need help with the move, our WordPress services cover site migrations.

How to Fix phpAfterShell on a VPS or Dedicated Server

If you run your own server, how to fix phpAfterShell is a package update plus a restart — and the restart is the step people forget. PHP keeps the old code in memory until its workers restart, so installing the fix without restarting changes nothing.

On Debian or Ubuntu:

sudo apt update
sudo apt install --only-upgrade php8.3-fpm php8.3-cli
sudo systemctl restart php8.3-fpm
php -v

Adjust the package names to your branch (php8.2-fpm, php8.4-fpm, and so on). Those four commands are the whole of how to fix phpAfterShell on Debian or Ubuntu. Ubuntu shipped fixed packages for 22.04, 24.04, and 26.04 on November 20, 2026; Debian fixed bookworm and trixie through its security repositories.

On RHEL, AlmaLinux, or Rocky Linux: update through your package manager or the Remi repository, then restart PHP-FPM:

sudo dnf update php*
sudo systemctl restart php-fpm
php -v

If you run PHP in Docker: the fix lives in the image, not in a running container. Rebuild every image that contains PHP — production, staging, internal tools, and old test containers — and redeploy. A container rebuilt from an old base image is still vulnerable, and forgotten staging containers are a classic way back in. Whatever your setup, the rule for how to fix phpAfterShell on your own server is the same: install the fixed packages, restart every PHP worker, and verify the web runtime.

Verify the web runtime, not just the command line. php -v shows the CLI binary, which can differ from the PHP-FPM workers serving your traffic. Confirm the version through a phpinfo() page on the web server (and delete the page afterwards), or check your Site Health screen in WordPress. This is the final check in how to fix phpAfterShell on a VPS, and the one most people skip.

how to fix phpAfterShell — update PHP to patched version 8.2.36 8.3.37 8.4.28 8.5.13

How to Fix phpAfterShell on WordPress: The 10-Minute Checklist

WordPress itself is not the vulnerability — the flaw is in PHP, one level below WordPress — so updating WordPress or installing a security plugin cannot fix it. But WordPress site owners still have a clear path, and the checklist below is how to fix phpAfterShell on WordPress from start to finish. Here is the complete checklist:

  1. Back up first. Take a full backup — files and database — before changing PHP versions, and confirm you know how to restore it. A PHP version change is low risk, but a backup turns a bad day into a five-minute restore.
  2. Check your PHP version in Tools → Site Health → Info → Server, and compare it with the fixed-version table above.
  3. Get PHP updated. On shared or managed hosting, ask your host (use the message template above). On your own server, install the fixed packages and restart PHP-FPM.
  4. Confirm the fix is live. Recheck Site Health and confirm the web-facing PHP version is 8.2.36, 8.3.37, 8.4.28, 8.5.13, or 8.6.0. Do not trust the command line alone. This is the step that proves how to fix phpAfterShell worked on your site — skip it and you are guessing.
  5. Update WordPress, plugins, and themes. The PHP update fixes PHP. While you are there, update everything else and remove plugins and themes you no longer use — they are the usual way attackers get in after a PHP flaw is patched.
  6. Purge every cache. Clear WordPress caching, server caching, and CDN caching so visitors get pages built by the new PHP.
  7. Test the site. Log in, submit a contact form, test an upload, complete a checkout if you sell anything, and check scheduled posts and the REST API.
  8. Check your logs. Review PHP, web-server, and security logs for unusual session errors or suspicious requests, especially multipart POSTs that carried upload-progress fields.
  9. Run a security audit. If you have never audited the site, use our WordPress security audit checklist as the follow-up pass.
  10. If you cannot update yet, apply the temporary mitigations in the next section today, and put the real update on the calendar for this week — not next month.

Can’t Patch Yet? Temporary Mitigations That Actually Help

Updating PHP is the only complete fix. But if your host needs a few days, or a legacy application blocks the upgrade, these mitigations reduce the risk today — they do not replace the update. Everything in this section is a stopgap while you arrange the real answer to how to fix phpAfterShell.

Turn off session upload progress. This closes the easiest attack path for both phpAfterShell and CVE-2026-115560. Add this to php.ini (or your PHP-FPM pool configuration), then restart PHP workers:

session.upload_progress.enabled = 0

Note that the fixed PHP releases turn upload progress off by default — but an explicit setting in your php.ini or FPM pool overrides that default, so check your own configuration rather than assuming. And remember the limit: disabling upload progress removes only one entry point. Applications that store large attacker-controlled strings in file-based sessions can still be reached another way, so this is a bandage, not a cure.

Move sessions off files. If your application supports it, store sessions in Redis or a database instead of files. This specific flaw does not apply to those stores — though PHP advises checking how each store handles an interrupted update, so treat it as risk reduction, not immunity.

Put a WAF in front of the site.Cloudflare’ WAF blocks known phpAfterShell attack patterns, including for customers on the Free plan. A firewall is an extra layer of defense, not a replacement for the patch — it buys time while you carry out how to fix phpAfterShell properly — and several of the critical flaws depend on server configuration or travel paths a WAF cannot see.

Disable FastCGI connection reuse if your setup uses it (nginx fastcgi_keep_conn on, Apache enablereuse=on), until the PHP-FPM request-smuggling flaw CVE-2026-129289 is patched. That flaw is separate from phpAfterShell, but it shipped in the same release and it is just as critical.

If you run PHP 8.1 or older, there is no mitigation that makes the risk go away — only the upgrade does. Plan the move to PHP 8.3 or 8.4 this week, test your site on staging first, and take a backup before switching. For those versions, that move IS how to fix phpAfterShell.

phpAfterShell vs PHP2Shell: Don’t Mix Them Up

The names sound alike, the flaws live in the same neighborhood, and the October patches are fresh in everyone’s memory — so confusion is the norm right now. Here is the difference in one table:

PHP2Shell (October 2026) phpAfterShell (November 2026)
CVEs CVE-2026-109618, CVE-2026-109619 CVE-2026-126714 (+ CVE-2026-115560)
Disclosed October 21, 2026 November 19, 2026
Root cause Objects activated during upload-progress callback Interrupted session file write leaves spliced data
Fixed in 8.2.35, 8.3.36, 8.4.27, 8.5.12 8.2.36, 8.3.37, 8.4.28, 8.5.13
Exploited in the wild? Yes — in CISA KEV, widely exploited No — none reported as of Nov 23, 2026
Does the October patch fix it? — No

Read our earlier coverage of the October PHP critical vulnerability for the full PHP2Shell story — and then update again. The uncomfortable truth of November is that the sites most at risk right now are the ones whose owners patched in October and stopped paying attention. If that describes you, the fix is the same: follow the steps above for how to fix phpAfterShell and close the November hole the same week it opened.

Signs Your Site May Already Be Compromised

No exploitation of phpAfterShell has been reported yet — but the November release also fixed flaws that sat undisclosed for weeks, and the October PHP2Shell flaws were widely exploited before many sites patched. If your site was slow to update, spend ten minutes checking for trouble before you work through how to fix phpAfterShell — a compromised site needs cleaning first, then patching.

  • New files or modified files you do not recognize, especially in upload directories, theme folders, or the site root. Compare against your backup.
  • Unknown admin users in WordPress, or users whose roles changed without explanation.
  • Spikes in server errors — especially HTTP 5xx responses around multipart POST requests, which can indicate a worker dying mid-write.
  • Unusual session errors in PHP logs, or session files in your temp directory with strange contents.
  • Traffic or content changes you did not make: new links, redirect rules, spam pages, or search results showing pages you never published.
  • Slowness or crashes that started recently without a traffic spike — a sign of workers being killed repeatedly.

If anything looks wrong, follow our guide on how to check if your WordPress site is hacked, change all admin and hosting passwords, restore from a clean backup, and then apply the PHP update. And if you would rather have a professional handle it, contact us — a compromised site gets worse the longer it waits.

Frequently Asked Questions

What is phpAfterShell?

phpAfterShell is a critical vulnerability (CVE-2026-126714, CVSS 9.2) in PHP’s default file-based session handler. When a PHP worker dies in the middle of writing a session file, the file can end up holding half new data and half old data. The next time PHP reads that session, it can deserialize attacker-chosen objects — and with a suitable gadget chain, run code on the server. It was disclosed on November 19, 2026 by the research company depthfirst, and fixed the same day in PHP 8.2.36, 8.3.37, 8.4.28, and 8.5.13. That is what you are fixing when you learn how to fix phpAfterShell.

How do I know if my site is affected by phpAfterShell?

If your site runs PHP below 8.2.36, 8.3.37, 8.4.28, or 8.5.13 (depending on your branch) and stores sessions in files — PHP’s default — treat it as affected. Check your version in WordPress under Tools → Site Health → Info → Server, or run php -v on your server. PHP 8.1 and older are end of life and get no fix at all.

Does updating WordPress fix phpAfterShell?

No. The flaw is in PHP itself, one level below WordPress, so no WordPress update, theme update, or security plugin can fix it. Only updating the PHP version on your server closes the hole. That is the core of how to fix phpAfterShell: update PHP, restart PHP-FPM, and verify the version serving your traffic.

Is phpAfterShell being exploited in the wild?

As of November 23, 2026, no exploitation in the wild had been reported, and none of the November vulnerabilities had been added to CISA’s Known Exploited Vulnerabilities catalog. The October PHP2Shell flaws, by contrast, were widely exploited — which is why patching now, while the window is still open, matters more than patching later.

What if my site runs PHP 8.1 or older?

PHP 8.1 and older receive no fix for phpAfterShell, because those branches are end of life. Move to a supported branch — PHP 8.3 or 8.4 is the sensible choice for most sites. Back up first, test on staging, update your plugins and themes, and then switch the PHP version in your hosting panel. About a third of WordPress sites still run PHP 8.1 or older, so if you have never checked, you may be one of them. Check today — the upgrade is how to fix phpAfterShell when no patch exists for your branch.

Conclusion

phpAfterShell is a 9.2 critical flaw in the PHP that runs most of the web, it survives the October patch, and it needs no login to reach. But it also has a clean, finished fix — and that is the whole story. Check your PHP version, update to 8.2.36, 8.3.37, 8.4.28, or 8.5.13, restart your PHP workers, and verify the version serving your traffic.

Do not let the October patch fool you into feeling safe. The sites that get hacked in December will not be the ones that never patch — they will be the ones that patched once and stopped looking. Now you know how to fix phpAfterShell. Ten minutes, one update, and the window closes — that is how to fix phpAfterShell, and there is no reason to leave it open another day.

Leave a Comment