PHP2Shell Vulnerability: Causes, Risks and How to Protect Your Website

PHP2Shell Vulnerability: Causes, Risks and How to Protect Your Website

If your website runs on PHP, this one is for you. On October 21, 2026, the PHP project shipped emergency fixes for two critical flaws in PHP itself, not in WordPress, not in a plugin, but in the language your site runs on. The pair has been nicknamed PHP2Shell, and attackers were already probing for it before the patch landed.

This is a fast-moving story, so I've kept the facts tight and noted where sources disagree. Here's what happened, why it happened, and what to do about it.

Quick answer: PHP2Shell is the nickname for CVE-2026-109618 and CVE-2026-109619, two critical (CVSS 9.2) memory bugs in PHP core that can let an unauthenticated attacker run code on your server. They reach back to PHP 5.4. The real fix is updating PHP to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 and restarting it. Turning off session.upload_progress helps, but only partly.

Key Facts at a Glance

  • CVEs CVE-2026-109618, CVE-2026-109619
  • Severity CVSS v4.0 9.2 (critical) each
  • Affected Versions PHP releases back to 5.4
  • Fixed in 8.5.12, 8.4.27, 8.3.36, 8.2.35 (Oct 21)
  • Exposed hosts ~2.24M internet-facing PHP hosts

1. What Is PHP2Shell?

It's two use-after-free bugs in PHP's core. In plain terms: PHP frees a chunk of memory, but something keeps using it afterwards. Attackers can steer what ends up in that memory, and that can turn into running their own code as your web server user, no login needed.

One of the two bugs can also leak memory on its own, a bit like Heartbleed did. Sansec's research says that leaked memory can contain passwords, session tokens, API keys and even TLS private keys from other visitors' requests.

A heads-up on confusion: early coverage tied the session upload feature to CVE-2026-109618, while later analysis (ELLIO) says that path belongs to CVE-2026-109619. The patch covers both, so it doesn't change what you do.

2. Why Did This Happen? The Real Causes

  1. A feature that's on by default. PHP's session upload-progress feature is enabled out of the box. It runs on file-upload requests before your application code even starts, which means your login screen, firewall plugin or clean code can't protect you. PHP says the risk is highest on mod_php, where an attack can succeed before any app code runs.
  2. Memory-safety bugs in old, low-level code. PHP's engine is written in C, where one missed cleanup can leave freed memory still pointed to. Researchers describe one flaw as a fatal error (like running out of memory) interrupting PHP before it cleans up, so a later request or a reused worker treats freed memory as live data.
  3. A very long exposure window. The affected code goes back to PHP 5.4 (2012). Millions of servers never moved off old versions.
  4. Patching that moves slowly. PHP powers WordPress, Drupal, Joomla, Magento, shared hosting and control panels. CybelAngel found that 59% of exposed hosts run versions that won't get an upstream fix. Shared hosts also patch on their own timeline, not yours.
  5. A leak and a fast attacker. Details leaked the day before the fix. Cloudflare reported the first attack attempts around 07:43 UTC on October 21, roughly six hours before the patch, and ELLIO's honeypots saw scans carrying the session upload field climb to 187 in a single hour that evening.

3. Who's Affected?

Any site serving web requests on PHP, which includes WordPress, Laravel, Drupal, Magento and custom PHP apps. And here's the part many people miss: updating WordPress, your theme or your plugins does not fix this. The flaw lives one layer lower, in PHP itself. (That's different from July's wp2shell, which was a WordPress core bug. I covered it in my WordPress security statistics report.)

Your PHP branch Fixed release
8.5 8.5.12
8.4 8.4.27
8.3 8.3.36
8.2 8.2.35 (security fixes only until Dec 31, 2026)
8.1 and older No upstream release. Vendor backport only, or upgrade

4. How to Protect Your Website

Follow these steps in order to secure your server against PHP2Shell:

  • Find your real PHP version. In WordPress, go to Tools → Site Health → Info → Server. Or check your hosting panel. If you have shell access, php -v tells you the command-line version, but confirm the one serving your site matches it.
  • Update to a patched release. On managed hosting, check your host's status page. On shared hosting, open a ticket and ask for a date. On a Debian/Ubuntu server, sudo apt update && sudo apt install --only-upgrade 'php8.*' upgrades all PHP packages together.
  • Restart PHP. Restart PHP-FPM or your web server so the new version actually loads. People forget this step.
  • Check vendor backports. Linux distributions often fix the bug without changing the version number, so confirm against your vendor's security advisory.
  • Verify afterwards. Re-check the version your site really runs on in WordPress Site Health.
  • Look for signs of trouble. Scan for unfamiliar admin users, strange PHP files (especially in uploads folders) and odd traffic. Rotating API keys and secrets is a sensible precaution.

If You Can't Patch Today

  • Set session.upload_progress.enabled = 0 (in php.ini, .user.ini or .htaccess). It closes the session path only, so treat it as a short-term shield, not a full fix.
  • Switch on managed WAF rules if your CDN or host offers them. Cloudflare had rules live by 03:02 UTC on October 21.
  • Sansec also suggests blocking multipart/form-data requests on pages that never need uploads.

If You're on End-of-Life PHP

PHP 8.1 and older got no upstream release. The honest answer is to move to a supported branch. Since 8.2 only gets security fixes until the end of 2026, aim for 8.3 or newer. As a bonus, newer PHP is also faster, which helps with the slow-site problems I wrote about here.

5. Is It Being Exploited?

Reports vary, and it's changing by the hour. Cloudflare, Aikido, Patchstack's hosting partners and ELLIO all reported attack attempts on October 21. One summary published that day (SOCRadar) noted PHP itself hadn't yet confirmed in-the-wild exploitation and CISA hadn't listed the CVEs. Sansec adds that a successful attack needs specific knowledge of the target server and conditions. So not every unpatched site is instantly owned, but automated tools lower that bar quickly. Treat it as actively targeted and patch.

Need Help Fixing This Vulnerability?

If you'd rather not chase your host for answers, this is the kind of thing I handle for clients. I can check which PHP version your site truly runs on, push your host for the patch, and safely upgrade your site.

Secure My Website Explore Security Services

Frequently Asked Questions

Is PHP2Shell the same as wp2shell?

No. wp2shell (July 2026) was a flaw in WordPress core. PHP2Shell is in the PHP runtime underneath, so it affects any PHP site, and WordPress updates don't fix it.

Is disabling session.upload_progress enough?

No. It blocks one known path only. PHP's own guidance is that patching is required.

My host hasn't patched yet. What now?

Ask for a patch date in writing, apply the stopgaps above, turn on WAF rules, and consider moving if they stall. Their silence is a risk in itself.

Which PHP version should I run?

Any patched release on a supported branch. I'd choose 8.3 or newer, since 8.2 only receives security fixes until December 31, 2026.

AM

Ajay Maanju — Web Development, SEO & AI Automation Expert

Ajay helps businesses grow online through high-performance websites, SEO strategy and mobile application development — including WordPress builds, speed and Core Web Vitals work, and site rescues. You work directly with him, not an account manager. Explore services at ajaymaanju.com →