PHP2Shell, the October 2026 PHP vulnerability: fixed versions and how to patch
Updated · What changed
PHP2Shell (CVE-2026-109618 and CVE-2026-109619) is fixed in PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, released October 21, 2026. PHP 8.1 and older get no fix, so sites on those versions have to move to 8.2 or newer.
Check a site now
Read-only: one standard page request, like a browser visit. We never send attack traffic.
What is the PHP vulnerability (PHP2Shell)?
PHP2Shell is two flaws in PHP itself, not in WordPress or any plugin. PHP rates both 9.2 (CVSS v4.0, PHP's rating). They can let an attacker run their own code on the web server without logging in. Details leaked on October 20, 2026, a day before the planned release, and PHP shipped the fixes on October 21, 2026.
Because the flaw is in PHP, it affects every PHP site: WordPress, WooCommerce, Laravel, Drupal, Joomla, Magento and custom code alike.
How PHP2Shell works
Both bugs start with a fatal error inside a request, such as PHP running out of memory. PHP describes them as remote code execution via out-of-memory corruption (CVE-2026-109618) and remote code execution via stale global state (CVE-2026-109619). The failed request leaves internal state behind, and the next request handled by the same PHP worker reuses it. According to Wiz (October 21, 2026), one path lets an attacker read the worker's memory, which can hold passwords, tokens and API keys; the other was developed into running code on the server. Wiz says even a "Hello World" application on an affected PHP version can be vulnerable, because the bug is in PHP, not in the site's code.
Which websites are affected
Any website whose server runs an affected PHP build, whatever the application on top. Visitors can't fix it or see it from the browser; the site owner or the host has to update PHP. To see the PHP version a site exposes, use the free PHP2Shell checker.
PHP also ships inside other products: NAS devices, firewalls and appliances with a web interface, control panels, and self-hosted apps. Those get the fix through the vendor's own update, not your host's. The UK's NCSC (October 21, 2026) tells organisations to inventory every PHP deployment, starting with internet-facing systems, and to watch vendor updates for products that bundle PHP. The Dutch NCSC keeps a list of affected products and vendor statuses.
Why websites went offline
The NCSC advises that where immediate remediation isn't feasible, organisations "should consider taking the system offline until it can be fully mitigated." The BBC reported on October 22, 2026 that the US National Security Agency gave similar advice on X, and that government and other sites in several countries went offline as a precaution. A site showing "down for maintenance" this week may be patching; it comes back once PHP is updated.
Which setups are at risk
PHP's security advisory says every PHP installation serving web requests is at risk: PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. It rates the risk highest for mod_php (PHP running inside Apache), where a demonstrated exploit needs one unauthenticated request and fires "before any application code runs". If your site runs on mod_php, patch it first.
Fixed versions
| Branch | Fixed in | Security support until |
|---|---|---|
| PHP 8.5 | 8.5.13 | Dec 31, 2029 |
| PHP 8.4 | 8.4.28 | Dec 31, 2028 |
| PHP 8.3 | 8.3.37 | Dec 31, 2027 |
| PHP 8.2 | 8.2.36 | Dec 31, 2026 |
| PHP 8.1 and older | No fix | Ended (8.1 on Dec 31, 2025) |
Not sure which version your site runs? Our free PHP2Shell checker reads it in under a minute, without sending any attack traffic.
If you use Debian, Ubuntu or Red Hat packages, the version number may stay the same while the fix is added. PHP says Linux distributions and long-term-support vendors received the patches in advance, so check your distribution's security tracker for the package: Debian, Ubuntu or Red Hat.
How to patch
Shared hosting with cPanel
- Log in to cPanel and open MultiPHP Manager.
- Find your domain and look at the PHP version. If it's 8.1 or older, choose 8.3 or 8.4. If it's already 8.2 to 8.5, the host has to install the fixed build, so ask support whether it's in place.
- Click Apply, then load your site and test the pages that matter: home, login, contact form, checkout.
Plesk
Open the domain, go to PHP, and pick a supported version. The PHP builds themselves are updated by whoever runs the server, under Tools & Settings, Updates.
Managed WordPress hosts
Hosts that manage PHP for you usually roll out fixed builds themselves. Check the PHP version in your host's dashboard, and if you're on 8.1 or older, switch to a newer version there.
Your own server or VPS
- Install the fixed PHP packages from your distribution or the repository you use, or rebuild your Docker image on a fixed PHP base image.
- Restart PHP-FPM and the web server so the new code is actually running.
- Confirm the version the web server uses, not only
php -von the command line, since the two can differ.
Step-by-step guides for each panel and server, including Docker: how to update your PHP version.
If you're stuck on PHP 8.1 or older
PHP won't release a fix for these versions. The real fix is moving to PHP 8.2 or newer. Old plugins, themes and custom code can break on the move, so back up and test on a copy first. See PHP 8.1 end of life for what changes on the way to 8.3.
Given the severity, PHP's security team also published minimal source backports for PHP 7.4, 8.0 and 8.1, for people who build PHP from source and have no long-term-support vendor. These are code branches, not releases, and your host won't install them for you.
If you can't update today: php.net's mitigations
PHP's advisory lists stopgaps that "reduce exposure to specific attack paths" but, in its words, "do not make an installation safe". Only the update is a complete fix. Set them where PHP reads them before a request is parsed: php.ini, the PHP-FPM pool, or the Apache configuration. ini_set() and FPM's .user.ini apply too late. Then restart every PHP worker.
For CVE-2026-109618 (out-of-memory corruption)
memory_limit = -1, set so applications can't override it, such asphp_admin_valuein the FPM pool or Apache configuration. Check that no pool, directory or application setting puts a finite limit back. PHP notes an underlying allocation failure can still reach the vulnerable code.- A low
post_max_size:8Mfor sites that don't take file uploads,32Mif they do, withupload_max_filesizebelowpost_max_size. PHP also suggests web server or proxy limits on decoded request size, input field count, multipart part count, header count and nesting depth, including for requests without a usableContent-Length. - A container or cgroup memory limit as the availability boundary, ideally one that kills only the affected worker. Do not use
RLIMIT_ASorRLIMIT_DATAinstead: PHP says these can cause the very allocation failure the attack needs.
For CVE-2026-109619 (stale global state)
session.upload_progress.enabled = 0, then restart every worker. This blocks the confirmed session paths, not other variants.- On PHP 8.5,
fatal_error_backtraces = 0, then restart every worker. This blocks the confirmed fatal-backtrace path only. - Remove invalid or deprecated per-request settings that emit diagnostics before PHP initialises. Hiding diagnostics with
error_reporting,display_errorsor@doesn't help. - Fix fatal errors and execution timeouts an attacker can trigger, including failures in callbacks, upload or import processing, and cleanup.
In a PHP-FPM pool file (for example www.conf), the settings look like this:
; PHP2Shell stopgap from php.net's advisory. Update PHP as soon as you can.
php_admin_value[memory_limit] = -1
php_admin_value[post_max_size] = 8M ; 32M if the site takes uploads
; keep upload_max_filesize below post_max_size
php_admin_flag[session.upload_progress.enabled] = off
php_admin_value[fatal_error_backtraces] = 0 ; PHP 8.5 only For mod_php, put the same settings in the Apache virtual host with php_admin_value and php_admin_flag, then restart Apache. These limits can break large uploads and some forms, so test after changing them.
Source: PHP security advisory, php.net, October 21, 2026. Security researchers have also suggested blocking multipart/form-data requests at the proxy, which breaks uploads and forms.
Cloudflare and other WAF rules
Cloudflare says its WAF has blocked known PHP2Shell attacks by default on every plan, Free included, since 3:02 UTC on October 21, 2026. On Pro, Business and Enterprise, check that the Cloudflare Managed Ruleset is in block mode. Wiz reports that Fastly, Google and Vercel also prepared mitigations, and WordPress.org notes that hosts may be adding WAF rules. A WAF rule is a layer on top, not the fix: Cloudflare itself says to update PHP as soon as possible, and a WAF only protects traffic that passes through it.
Want to know the day it matters? Continuous monitoring reads the real PHP version from inside your server every day and emails you the day a new fix applies to your site, plus the signs of a break-in. See pricing.
How many popular sites have taken the fix? See the PHP2Shell patch tracker.
Questions
Which PHP versions fix PHP2Shell?
PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, all released October 21, 2026.
Which versions are affected?
Reports say every PHP version from 5.4 up to the fixed releases. PHP only ships fixes for 8.2 and newer.
Which setup is most at risk?
PHP's advisory says every installation serving web requests is at risk (PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP, LiteSpeed) and rates the risk highest for mod_php, where a demonstrated exploit runs from one unauthenticated request before any application code.
Is PHP2Shell being exploited in the wild?
Security firms reported attack attempts on October 21, 2026, starting before the fix was out, and Cloudflare's CTO told the BBC on October 22 that he was seeing early attacks emerging. Treat any unpatched public PHP site as a target.
Is PHP 7.4 affected by PHP2Shell?
Yes. Reports say every version from 5.4 on is affected, and PHP 7.4 has had no security releases since Nov 28, 2022. PHP's security team published a source backport for 7.4, but no 7.4 release. For most sites the fix is moving to PHP 8.2 or newer.
Does Cloudflare block PHP2Shell?
Cloudflare says its free and paid WAF have blocked known PHP2Shell attacks by default since 3:02 UTC on October 21, 2026; paid plans should check the Managed Ruleset is set to block. Cloudflare still tells customers to update PHP, and a WAF only helps if all traffic reaches the site through it.
Is PHP2Shell like Heartbleed?
Wiz, one of the firms that found it, describes one part as Heartbleed-style memory disclosure: an attacker can read memory from a PHP worker, which can hold passwords, tokens and keys. The other part leads to running code on the server, which Heartbleed did not.
Why are websites down for maintenance because of PHP?
The UK's NCSC and the US NSA advised organisations that can't patch or apply mitigations quickly to consider taking systems offline until they can. On October 22, 2026, the BBC reported government and other sites going offline as a precaution.
Is PHP2Shell the same as wp2shell?
No. wp2shell (CVE-2026-63030 and CVE-2026-60137) was a WordPress core flaw fixed in July 2026. PHP2Shell is in PHP itself and affects every PHP application, WordPress included.
Do I have to restart anything?
Yes. PHP-FPM pools and Apache (for mod_php) keep running the old code until they restart. Hosting panels usually restart for you when you switch versions.
Running WordPress? See PHP2Shell for WordPress sites. Every other PHP security fix this year: PHP vulnerabilities by version.
Changelog
- October 22, 2026 (later): Added how PHP2Shell works, which websites are affected, why sites went offline, Cloudflare's WAF rules, the Ubuntu and Red Hat trackers, and answers on PHP 7.4 and Heartbleed.
- October 22, 2026: Added php.net's own php.ini mitigations, its note that mod_php is the highest-risk setup, and its source backports for PHP 7.4, 8.0 and 8.1.
- October 21, 2026: Published: CVEs, fixed versions, and how to patch on cPanel, Plesk, managed hosting and your own server.
Checked December 3, 2026. Sources:
- PHP security advisory: critical remote code execution vulnerabilities, php.net (Oct 21, 2026)
- Supported versions, php.net
- Unsupported branches, php.net
- Sansec: PHP2Shell (Oct 21, 2026)
- Debian security tracker: CVE-2026-109618
- PHP 8 ChangeLog (CVE fixes per release), php.net
- Wiz: PHP2Shell, critical RCE in the PHP engine (Oct 21, 2026)
- Cloudflare: protections against php2shell (Oct 21, 2026)
- UK NCSC: critical security issue affecting PHP (Oct 21, 2026)
- NCSC-NL: PHP2Shell affected products list
- BBC News: websites taken down worldwide (Oct 22, 2026)
