php2shell: the critical PHP vulnerability and what to do now
PHP fixed two critical vulnerabilities on 21 October 2026. How to tell if your site is affected, and which PHP version your server needs.
- Published
- Updated
- Reading time
- 14 min

In short
- php2shell is the name given to two critical PHP vulnerabilities, both rated 9.2 out of 10. PHP fixed them on 21 October 2026 in 8.2.35, 8.3.36, 8.4.27 and 8.5.12.
- An attacker can run code on the server without logging in, on WordPress and Laravel alike. Security plugins such as Wordfence don't help, because the bug is in PHP itself.
- Amazon saw the first exploitation attempt on 17 October, four days before PHP fixed the bugs. Patch PHP now, or ask your provider to confirm they have. PHP 8.1 and older need upgrading or a patched package from Ubuntu, Ondřej Surý or Remi Collet.
php2shell is the name given to two critical vulnerabilities in PHP, the programming language WordPress and Laravel are written in. They let an attacker run code on the server without logging in. PHP fixed both on 21 October 2026 in versions 8.2.35, 8.3.36, 8.4.27 and 8.5.12. Make sure your server runs one of those, whether you look after it yourself or pay someone to.
Status 23 October 2026, 11:15 CEST: VulnCheck has built an exploit that works against servers running PHP 8.4 with standard production settings. It gets past ASLR, an operating system defence that makes attacks like this harder. Only VulnCheck's customers have access to it. Cloudflare has seen millions of exploitation attempts, and nobody has confirmed a successful compromise yet. The attack can also read passwords and keys from PHP's memory, so rotate them if your server was exposed.
What is php2shell?
The two vulnerabilities are CVE-2026-109618 and CVE-2026-109619. PHP rates both 9.2 out of 10 on CVSS v4.0. The name isn't PHP's own: it's what Calif and Wiz, who found the bugs, call them. It describes what a successful attack gets you: a shell on the server. Calif reported the first bug to PHP on 11 August and Wiz followed on 24 August. The CVE numbers leaked on 20 October, and PHP brought the release forward a day to 21 October. That evening Calif accidentally published a video of the attack.
Both bugs come down to PHP cleaning up after a request that was cut short:
- CVE-2026-109618: If PHP runs out of memory while it's still setting up a request, it bails out halfway. The cleanup that follows treats half-initialised memory as valid. An attacker can exhaust memory on purpose with a multipart request built to use far more memory than its size suggests.
- CVE-2026-109619: A PHP worker keeps some state from one request to the next. If a fatal error interrupts a request, that state can end up pointing at memory that has already been freed, a use-after-free. The next request to the same worker can then pick up data the attacker put there. PHP has confirmed two routes in:
session.upload_progress, which tracks how far a file upload has got, and thefatal_error_backtracessetting in PHP 8.5.
What PHP has confirmed about the attack:
- No login is needed. It can take many attempts, and more PHP workers make it harder but not impossible.
- On Apache with mod_php, PHP demonstrated code execution before WordPress, Laravel or any other application code had started. That's where the risk is highest.
- On PHP-FPM, the confirmed attack needs the application to hit a fatal error the attacker can trigger. FrankenPHP cleans up the same way mod_php does, and PHP considers it likely to be just as exposed.
session.upload_progressis on by default and works even if your site has no upload form.
Calif and Wiz have used the attack to run code on WordPress, Drupal, Joomla and Magento, among others, in test environments. Wiz says almost every PHP version back to 5.4 is affected by at least one of the two bugs.
Wiz has also shown that the attack can read PHP's memory without running code on the server. That memory can hold passwords, API keys, certificates and login tokens from other requests, and reading it leaves no files behind.
Is your site affected by php2shell?
Yes, if it runs on PHP and the server isn't on one of the versions below. PHP says every installation serving web requests is at risk: PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. W3Techs puts PHP behind 69.3% of websites whose server-side language is known. That covers WordPress and WooCommerce, Drupal, Joomla and Magento, plus anything built with Laravel, Symfony or plain PHP.
| PHP branch | Fixed in |
|---|---|
| 8.2 | 8.2.35 |
| 8.3 | 8.3.36 |
| 8.4 | 8.4.27 |
| 8.5 | 8.5.12 |
| 8.1 and older | No new release from PHP |
Linux distributions received the patches before they went public, and Ubuntu and Debian shipped patched PHP packages on 21 October. Ubuntu keeps the old version number, so PHP on Ubuntu 24.04 still reports 8.3.6 after the fix. AlmaLinux has shipped patched packages for every PHP stream on AlmaLinux 8, 9 and 10, and so has Remi Collet, whose repository many people use for newer PHP on RHEL, AlmaLinux and Rocky Linux. Red Hat has released updates for some of its PHP streams and is working on the rest. The patched package versions are listed in how to patch PHP for php2shell.
Keeping WordPress and its plugins up to date won't help here. The bug is in PHP itself, and on Apache with mod_php the attack happens before a security plugin such as Wordfence gets to see the request. Only a patched PHP build on the server closes it.
Who does the work depends on where the site lives:
| Where the site runs | Who updates PHP | What you do |
|---|---|---|
| Shared hosting | Your hosting provider | Ask them to confirm PHP is patched, and when |
| Managed hosting or a support contract | Your provider or developer | Ask the same, and whether they're checking for intrusions |
| Your own server (VPS) | You or your developer | Update the PHP packages and restart PHP |
| Docker or Kubernetes | You or your developer | Rebuild the image on the patched PHP and deploy it |
| PHP 8.1 or older | Nobody, PHP ships no new release | Upgrade, and keep the site off the public internet until you have |
Large hosting providers patch PHP centrally for every shared hosting customer, usually within a couple of days. In our view the real risk sits with servers nobody clearly owns. Think of a VPS a previous agency set up in 2019, a Docker image pinned to php:7.4-apache, or an old campaign site on a subdomain everyone has forgotten about.
How to protect your site from php2shell
- Find out who updates PHP. If you pay for shared hosting, it's your hosting provider. If you're not sure, our knowledge base explains how to find out who hosts your website.
- Check your PHP version. In WordPress it's under Tools → Site Health → Info → Server. You need 8.2.35, 8.3.36, 8.4.27, 8.5.12 or later. If the server uses Ubuntu's own PHP packages, check the package version instead. On Ubuntu 24.04 the fix arrived in 8.3.6-0ubuntu0.24.04.13.
- Patch today, then restart PHP. An updated package on disk protects nothing until every process holding PHP in memory has restarted. That means PHP-FPM and Apache, but also queue workers and application servers such as Laravel Octane and FrankenPHP. Our knowledge base has the steps for shared hosting, Ubuntu, Debian and Docker: how to patch PHP for php2shell.
- If you can't patch today, apply PHP's stopgaps. Turn off
session.upload_progressin php.ini, the PHP-FPM pool or the Apache configuration, then restart every PHP worker..user.iniandini_set()don't work, because PHP reads them after it has already parsed the request. On PHP 8.5, turn offfatal_error_backtracesas well. These close only the routes PHP has confirmed and don't replace the patch. The full list is in how to patch PHP for php2shell. - Isolate whatever you can't patch. PHP ships no new releases for 8.1 and older. CERT-EU recommends taking such services off the public internet until they're upgraded, for instance behind a VPN or restricted to known IP addresses. Cloudflare has had rules against the attack on every plan, Free included, since 05:02 CEST on 21 October. They only help if your server can't be reached directly on its IP address, and Cloudflare has already seen attackers tweaking the payload to get past them.
- Look for signs of compromise from 17 October onwards. That's when Amazon saw the first attempt. Keep your logs before you patch, so a deploy or log rotation doesn't wipe them. Look for PHP files in upload folders such as
wp-content/uploads, unfamiliar admin users, new cron jobs, and changes to.htaccess,.user.iniorauto_prepend_file. Unknown SSH keys inauthorized_keysare a clear sign someone has been on the server. The full walkthrough is in how to check whether your server was attacked through php2shell. - Rotate passwords and keys if the server was exposed. The attack can read passwords and keys from memory without leaving a trace. If the server ran a vulnerable PHP version after 17 October, change the database password, the API keys for payments and email, and the security keys in
wp-config.php. New security keys log out everyone who's signed in.
How we patched our own servers
Every server we run was on patched PHP by 18:57 CEST on 21 October, about three hours after the fix came out. The stopgap was already in place before that. The official FrankenPHP images didn't arrive until 19:45, so instead of waiting we built our own on PHP 8.3.36, 8.4.27 and 8.5.12.
If you're thinking about changing provider, or want someone to look over your server, we'd be glad to talk. We're getting a lot of calls about php2shell and have extended our opening hours over the next few days, so we'll get back to you as quickly as we can. Call us on +47 40 10 10 30.
Patching doesn't remove an intrusion
The fix closes the holes. It doesn't remove anything an attacker left behind before you patched. After bugs like this, attackers usually drop a web shell, a small PHP file that accepts commands, and come back to it later. That's why many owners only notice weeks afterwards:
- Google shows Japanese search results for your site (the Japanese keyword hack)
- Visitors get redirected to spam or scam pages (spam redirects)
- Admin users you don't recognise appear
- Chrome or Google Search Console flags harmful content (Google warnings)
- The server slows down because someone is mining cryptocurrency on it
Our knowledge base covers the signs that a site has been hacked and how to remove malware. If the attacker got onto the server itself, the safe route is to rebuild the server from a clean backup and rotate every password and key.
How soon will attacks start?
Once a fix is public, anyone can compare the code before and after and work out the bug. That's what happened with CVE-2024-4577, a critical flaw in PHP-CGI on Windows. PHP shipped the fix on 6 June 2024, and Imperva saw attacks from 8 June, including the TellYouThePass ransomware. That bug only affected Windows servers with a specific setup. php2shell affects every platform running PHP's default settings.
This time the attacks started before the fix was out. Amazon's honeypots caught an exploitation attempt on 17 October, four days before the bugs were made public, and it's not clear how the attacker knew about them. From 02:00 UTC on 21 October more attempts arrived with different payloads, and Cloudflare saw attacks against its customers later that morning.
Amazon, watchTowr and Arctic Wolf are now all seeing exploitation attempts, and Cloudflare's chief executive Matthew Prince says the company has counted millions. Arctic Wolf has seen attacks that try to download known malware onto the server. Nobody has confirmed a successful compromise so far.
PHP accuses Chainguard, which builds container images, of breaking the embargo. Chainguard published images with the fix at 07:41 UTC on 21 October, more than six hours before the coordinated release, which let anyone compare the old and new images and find the bug. Chainguard says people were already being attacked.
Hundreds of GitHub repositories claim to exploit the bugs, though VulnCheck says very few of them work. PHP's security team went through what had leaked and found no working exploit at the time of the release. Tenable warns against running the code on GitHub, as code like this is sometimes laced with malware. To find out whether your server is exposed, check its PHP version rather than trying the attack.
Datadog has reproduced the attack against Apache with mod_php in a lab, and Norway's National Security Authority (NSM) expected a working exploit to follow soon. By 22 October VulnCheck had one for CVE-2026-109618, targeting standard servers on PHP 8.4.10 to 8.4.26. It succeeds with display_errors off, the production setting PHP recommends, and defeats ASLR, which loads programs at random memory addresses. VulnCheck only shares it with paying customers. One of the GitHub projects also got past ASLR, but in VulnCheck's testing it only worked on PHP 8.4.26.
Memory corruption bugs are harder to exploit reliably than a command injection, and this one can take many attempts. Red Hat considers the attack hard to pull off against PHP-FPM, because PHP-FPM kills the worker when PHP fails while still reading the request. Apache with mod_php is the most exposed, as the attack there needs no help from the application. As VulnCheck warns, an attack being hard to pull off doesn't mean you're protected from it.
PHP 8.1 and older get no new release
PHP only ships new releases for 8.2, 8.3, 8.4 and 8.5. PHP 8.1 lost security support on 31 December 2025, and PHP 7.4 in November 2022. Even so, W3Techs reports that 27% of PHP sites still run PHP 7 and 7.7% run PHP 5.
Given how serious these bugs are, the PHP security team has also written a minimal patch for 7.4, 8.0 and 8.1, and it's already in several package repositories:
- Ubuntu has patched PHP 8.1 on Ubuntu 22.04, and PHP 7.0, 7.2 and 7.4 on Ubuntu 16.04, 18.04 and 20.04 for Ubuntu Pro customers.
- Ondřej Surý's packages, which many people use to run newer or older PHP on Ubuntu and Debian, carry the fix for every branch from 5.6 to 8.1.
- AlmaLinux has patched PHP 7.2, 7.3, 7.4 and 8.0 on AlmaLinux 8 and PHP 8.1 on AlmaLinux 9, but makes no promise of further fixes for those retired streams.
- Remi Collet's packages for RHEL, AlmaLinux and Rocky Linux carry the fix for PHP 7.4, 8.0 and 8.1.
If you build PHP yourself, you'll need to apply the patch yourself. If you're not sure where your server's PHP comes from, ask your provider. The patch only closes php2shell, and PHP 8.1 and older still get no other security fixes from PHP.
If you're upgrading now, skip 8.2. Its security support ends on 31 December 2026, ten weeks from now. WordPress recommends PHP 8.3 or newer, and PHP 8.4 is supported until the end of 2028.
A site on PHP 7.4 hasn't had a security fix for almost four years. php2shell makes that visible, but the problem was already there. What usually blocks the upgrade is old plugins or custom code that won't run on newer PHP. Read more about the PHP version in WordPress and technical debt in WordPress. For custom applications, see how we approach Laravel development.
Changelog
We'll keep updating this article as news of attacks comes in. Newest entry first.
- 23 October 2026, 11:15 CEST: VulnCheck has built an exploit that works against servers running PHP 8.4 and gets past ASLR. We've also added Cloudflare's count of millions of attempts. Our advice hasn't changed.
- 22 October 2026, 11:45 CEST: Amazon saw an exploitation attempt as early as 17 October, so we now tell you to look for signs of compromise from that date. We've also added patched packages from Remi, Red Hat's view on PHP-FPM, Datadog's lab reproduction and PHP's dispute with Chainguard.
- 21 October 2026, 23:55 CEST: Wiz has shown that the attack can read passwords and keys from memory, so we've added advice on rotating them. We've also added AlmaLinux's patched packages, a warning about exploit code on GitHub and how we patched our own servers. The email template for your provider is gone.
- 21 October 2026, 20:45 CEST: Cloudflare and watchTowr have seen exploitation attempts. We've added the attack status, patched packages from Ubuntu, Debian and Ondřej Surý (PHP 8.1 and older included) and Cloudflare's rules. Our own servers now run patched PHP.
- 21 October 2026, 17:30 CEST: PHP has released 8.2.35, 8.3.36, 8.4.27 and 8.5.12 and published the details. We've added the fixed versions, how both vulnerabilities work and PHP's own stopgaps. The leaks were partly right:
session.upload_progressis one of several routes in, and.user.inidoesn't work as a stopgap. - 21 October 2026, 11:45 CEST: Published. PHP has announced the security release but not the details or fixed versions.
If you're not sure who's responsible for your server, send us your website address and we'll tell you what we see, with no obligation. Read more about IT security at PXL and WordPress at PXL.
Sources and further reading
- Security advisory: Critical remote code execution vulnerabilities, update now and Supported Versions, php.net
- RCE via OOM corruption (CVE-2026-109618) and RCE via stale global state (CVE-2026-109619), PHP's security advisories on GitHub
- Security Advisory 2026-018: Critical Vulnerabilities in PHP, CERT-EU
- Today's PHP Security Release, and How We're Strengthening PHP Security, The PHP Foundation
- Oppdatert varsel: To kritiske sårbarheter i PHP, Norwegian National Security Authority (in Norwegian)
- PHP2Shell: AI uncovers critical RCE vulnerabilities affecting 70% of the Internet and php2shell.com, Wiz
- PHP2Shell: Critical PHP RCE, Sansec
- Amazon Threat Intelligence identifies PHP2Shell exploitation prior to public disclosure in MadPot, Amazon
- PHP2Shell: Critical vulnerabilities in PHP, Datadog Security Labs
- Finding, Prioritizing, and Patching PHP2Shell Exposure, Arctic Wolf
- PHP2Shell Vulnerabilities: CVE-2026-109618 and CVE-2026-109619, VulnCheck
- PHP2Shell exploit bypasses protections designed to stop remote code execution, The Register
- Cloudflare sees millions of exploit attempts after PHP disclosure, Reuters
- PHP blames supply chain security biz Chainguard for putting huge chunks of the web at risk, The Register
- php2shell: Patched PHP packages released, AlmaLinux
- Security bulletin RHSB-2026-013, Red Hat
- php2shell: Frequently asked questions, Tenable
- Cloudflare deploys protections against php2shell vulnerability, Cloudflare
- CVE-2026-109619: PHP Remote Code Execution Exploited, watchTowr
- CVE-2026-109618 at Ubuntu and at Debian
- Usage statistics of PHP, W3Techs
- PHP command injection flaw exploited to deliver ransomware (CVE-2024-4577), Help Net Security


