//security advisory
PHP2Shell: Remote Code Execution in PHP
PHP2Shell is a pair of critical flaws in PHP itself, CVE-2026-109618 and CVE-2026-109619, that let an attacker run code on a web server by sending crafted requests, with no login and no bug in your application needed. Exploit details are public and attacks have been reported. Update PHP, then restart it.
On this page
Are you affected by PHP2Shell?
Find the row that describes you. If PHP serves anything on the internet, assume you are affected until you have checked.
You run PHP websites or APIs on your own servers or containers
PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP, LiteSpeed
Act nowUpdate to a fixed version today and restart every PHP process. Apache with mod_php is at the highest risk. Find your fixed version
You run PHP 8.1 or older
Including 7.x and 5.x
Act nowThese versions are affected and the PHP project will not release a fix. Install your vendor’s backported package if one exists, or upgrade to PHP 8.2 or later.
Your PHP runs on a managed host or platform
Shared hosting, cPanel, Plesk, App Engine, Laravel Cloud
Update neededConfirm with your provider that PHP is patched. Several platforms patched automatically, but custom images and containers must be rebuilt and redeployed by you. Platform status
You run products that bundle PHP
Appliances, control panels, Windows software with php-cgi.exe
Update neededAsk the vendor for a fixed build. The Dutch NCSC keeps a list of products that embed PHP.
Your site sits behind Cloudflare, Akamai or another firewall
A CDN or web application firewall in front of PHP
Update neededThese services now block known attacks automatically, which buys you time. They do not fix PHP, so update anyway. What each provider covers
You only use PHP on the command line
Scripts, Composer, cron jobs that do not serve web requests
Low riskPHP describes the risk as installations that serve web requests. Update with your next routine patch.
What to do
Work through these in order. Most teams can finish the first three today.
Find every PHP that serves web traffic
Include servers, container images, control panels and products that bundle PHP. Check the PHP that serves requests, not only the one on the command line: they are often different installs. How to checkUpdate to a fixed version
Install 8.5.12, 8.4.27, 8.3.36 or 8.2.35, or your distribution’s patched package. Rebuild container images on a patched base image. Patched versionsRestart every PHP process
Restart PHP-FPM, Apache, and any long-running PHP workers such as queue workers or Laravel Octane. A process that started before the update keeps running the vulnerable code.If you cannot update today, reduce the exposure
Apply PHP’s temporary measures and update as soon as a package is available. They block the known attack paths, not all of them.Check for signs of compromise and rotate secrets
Exposed servers may already have been attacked, and one of the flaws can leak server memory. What to look for
Patched versions
Fixed versions as of 21 October 2026, 16:30 UTC. Every row links to the vendor’s own advisory, tracker or changelog. Packages are still being released, so check the source if your platform is listed as not yet fixed.
PHP releases
| Branch | Affected | Fixed in |
|---|---|---|
| 8.5 | 8.5.11 and earlier | 8.5.12 |
| 8.4 | 8.4.26 and earlier | 8.4.27 |
| 8.3 | 8.3.35 and earlier | 8.3.36 |
| 8.2 | 8.2.34 and earlier | 8.2.35 |
| 8.1 and older | All versions | No official release |
For PHP 7.4, 8.0 and 8.1, the PHP security team published minimal source backports for people who build PHP themselves, but no official releases. PHP 8.2 reaches end of life on 31 December 2026.
Operating systems and images
| Software | Fixed in | Source |
|---|---|---|
| Ubuntu 22.04, 24.04, 26.04, 26.10Ubuntu Pro also has fixes for 14.04, 16.04, 18.04 and 20.04. | php8.1 8.1.2-1ubuntu2.28, php8.3 8.3.6-0ubuntu0.24.04.13, php8.5 8.5.4-0ubuntu1.5, php8.5 8.5.9-0ubuntu2.1 | Ubuntu CVE tracker |
| Debian 13 trixie | php8.4 8.4.27-1~deb13u1 | DSA-6574-1 |
| Debian 12 bookworm | php8.2 8.2.35-1~deb12u1 | DLA-4848-1 |
| Arch Linux | php 8.5.12-1 | Arch package |
| Docker Official php imagePull again and rebuild. The RC1 tags do not contain the fix. | 8.5.12, 8.4.27, 8.3.36, 8.2.35 tags | docker-library/php #1694 |
| Windows builds (windows.php.net) | 8.5.12, 8.4.27, 8.3.36, 8.2.35 | PHP advisory |
Distributions often backport the fix without changing the PHP version number. Ubuntu 24.04’s fixed package is still PHP 8.3.6, for example. Check the package version, not only php -v.
Hosting platforms
| Platform | Fixed in | Source |
|---|---|---|
| cPanel EasyApache 4EA4 v25.91 also backports the fix to ea-php74, ea-php80 and ea-php81. | ea-php85 8.5.12, ea-php84 8.4.27, ea-php83 8.3.36, ea-php82 8.2.35 | EasyApache 4 changelog |
| Plesk on LinuxFixes for PHP 7.4 to 8.1, and for Plesk on Windows, are in development. | 8.5.12, 8.4.27, 8.3.36, 8.2.35 | Plesk support article |
| Google App Engine and Cloud RunApplies to the standard environment and to Cloud Run with automatic base image updates. Flexible environment and custom images must be redeployed. PHP 8.1 and older stay vulnerable. | PHP 8.2 and later, patched automatically | Google Cloud blog |
| Laravel VaporCustom and Docker runtimes must be rebuilt. | Native runtimes for PHP 8.3 and later | Laravel blog |
Not yet fixed
| Software | Status | Source |
|---|---|---|
| Red Hat Enterprise Linux | Rated Important. No fixed package listed yet. | Red Hat CVE page |
| Amazon Linux 2 and 2023 | Pending fix. No fix planned for the php8.1 package on Amazon Linux 2023. | Amazon Linux security center |
| SUSE Linux Enterprise | Pending. Updated packages are in testing. | SUSE CVE page |
| Fedora | Updates submitted and in testing. | Red Hat Bugzilla |
| Debian unstable | Still on php8.4 8.4.26. | Debian security tracker |
| Remi’s repository | No update on 21 October. PHP suggests distribution packages or building from source. | PHP advisory |
| Homebrew | Formulae still on 8.5.11, 8.4.26, 8.3.35 and 8.2.34. | Homebrew php formula |
| Laravel Forge, Ondřej Surý PPA | PHP 8.5 is patched. 8.2 to 8.4 are waiting on the PPA. | Laravel blog |
Until a package arrives for these, apply the temporary measures. We could not confirm the status for Alpine, Bitnami, AlmaLinux, Rocky Linux, AWS Lambda or Azure App Service from their own pages.
Check your version
The PHP that serves web requests can be a different install from the one on the command line, with its own version and settings. Check both.
On the server
php -v # the command-line PHP
php-fpm -v # may be named php-fpm8.3, php-fpm84 and so on
apachectl -M | grep -i php # any output means Apache loads mod_phpCompare the result with the fixed versions. If PHP came from your distribution, check the package changelog for the CVE numbers instead. A match means the fix is installed.
zgrep -E "CVE-2026-10961[89]" /usr/share/doc/php*-common/changelog.Debian.gzrpm -q --changelog php-common | grep -E "CVE-2026-10961[89]"Through the web server
To see the version and settings that live requests actually use, save this as a PHP file with a hard-to-guess name in your web root, open it once in a browser, then delete it.
<?php
echo PHP_SAPI, " ", PHP_VERSION, "\n";
echo "session.upload_progress.enabled=", var_export(ini_get("session.upload_progress.enabled"), true), "\n";
echo "memory_limit=", ini_get("memory_limit"), "\n";
echo "post_max_size=", ini_get("post_max_size"), "\n";The first line shows the server interface, for example fpm-fcgi or apache2handler for mod_php, and the version. The other lines show whether the temporary measures below are in effect. Do not leave the file in place or use a public phpinfo() page instead.
If you cannot update today
PHP is clear that there is no complete workaround: these measures block the attack paths that are known, not every variant. Use them only until the update is installed.
Change three PHP settings
From PHP’s advisory. Turning off session upload progress blocks the confirmed paths for CVE-2026-109619. Removing PHP’s memory limit and capping request size reduces exposure to CVE-2026-109618. Set them in server configuration so applications cannot change them, then restart every PHP process.
PHP-FPMAdd to each pool file, for example /etc/php/8.3/fpm/pool.d/www.conf
php_admin_flag[session.upload_progress.enabled] = off
php_admin_value[memory_limit] = -1
php_admin_value[post_max_size] = 8MApache with mod_phpAdd to the server or virtual host configuration
php_admin_flag session.upload_progress.enabled off
php_admin_value memory_limit -1
php_admin_value post_max_size 8Mphp.iniFor other setups. Check that no pool or virtual host overrides it
session.upload_progress.enabled = 0
memory_limit = -1
post_max_size = 8M- Use
post_max_size = 32Mif your application accepts uploads, and keepupload_max_filesizebelow it. - On PHP 8.5, also set
fatal_error_backtracesto off the same way. - With no memory limit, a single request can use all the memory on the server. Cap memory with a container or cgroup limit instead. Do not use
RLIMIT_ASorRLIMIT_DATA: PHP says these can trigger the flaw. - Setting these with
ini_set()or a.user.inifile does not work.
We checked that each snippet takes effect, using the official PHP 8.4 images with PHP-FPM and Apache. We did not test them against the exploits.
Block file upload requests at the web server
The known attacks arrive as multipart form requests, the format browsers use for file uploads. If your site does not accept uploads, Sansec suggests rejecting them outright. This is not part of PHP’s advice, and it breaks every upload form and some checkout forms.
nginxInside the server block
if ($http_content_type ~* "multipart/form-data") { return 403; }ApacheInside the <Directory> block for your web root. Requires mod_rewrite
RewriteEngine On
RewriteCond %{HTTP:Content-Type} multipart/form-data [NC]
RewriteRule ^ - [F]In our tests, both rules returned 403 for upload requests, including unusual spellings of the content type, and let ordinary form posts through. The Apache rule only worked inside a <Directory> block: placed in the global server configuration, it was silently ignored by the virtual host and blocked nothing. Send a test upload to confirm it is working.
Automatic protections from security providers
Several security providers have added rules that block the known attacks, some of them switched on for every customer without any action. They are worth having while you patch. Do not depend on them.
Why a firewall rule is not enough
- The rules recognise the attacks known so far. Cloudflare reports attackers already changing their payloads to get past its rules, and Wiz says there are more variants of the flaw than the published ones.
- They only see traffic that passes through the provider. If your server can be reached directly, the rules do nothing, so allow connections only from the provider’s IP ranges.
- Some are off until you turn them on, or only log matches instead of blocking them.
- Cloudflare calls its rules a stopgap, Fastly calls its virtual patch partial protection, and the PHP2Shell researchers say not to treat a protective rule as a substitute for updating PHP.
What each provider has announced
| Provider | What it does | What you need to do | Source |
|---|---|---|---|
| Cloudflare WAF | Managed rules switched on by default for every plan, including Free, since 03:02 UTC on 21 October, plus a new rule that inspects the server’s response. | Free: nothing. Pro, Business and Enterprise: confirm the Cloudflare Managed Ruleset is set to block, not log. | Cloudflare blog |
| Akamai App & API Protector | Adaptive Security Engine rule 3000991, plus existing command injection rules that Akamai says stop weaponised payloads. | Akamai does not say whether the rule is on by default. Check that it is active and blocking. | Akamai blog |
| Fastly Next-Gen WAF | A virtual patch for both CVEs that looks for the request shapes these attacks use. | Apply the virtual patch to each service yourself. Fastly then updates it automatically. | Fastly blog |
| Cisco Snort | Intrusion prevention signatures 67359 and 67360, also in the free Community Ruleset. | Update your ruleset and make sure the signatures block rather than alert. | Cisco Talos |
| WordPress VIP | Automattic says every site on its platform was protected before the release. | Nothing. | WordPress VIP notice |
| CrowdStrike Falcon | Detects what attackers do after getting in, such as web shells and shells started by PHP. It does not block the attack itself. | Make sure someone acts on the alerts. | CrowdStrike blog |
| Wiz Sensor | A response policy that stops processes behaving like a PHP2Shell exploit. | Turn the policy on. It needs sensor version 1.0.12768 or later. | Wiz blog |
Wiz also credits AWS, Microsoft, Imperva and Vercel with preparing mitigations, but none of them had published anything about these flaws on their own sites at the time of writing. The general PHP rule groups in AWS WAF and Google Cloud Armor are not specific to these flaws. If your provider is not listed, ask it directly.
Signs of compromise
These attacks happen inside PHP before your application runs, so application logs usually show nothing. A missing signal does not prove a server is safe.
During an attack
- Unusual multipart requests followed by memory errors or repeated HTTP 500 responses (Wiz).
- Unexpectedly large or garbled
PHPSESSIDcookies in responses, which can mean server memory is leaking. - PHP workers crashing or restarting for no clear reason.
According to CrowdStrike, the one trace an attempt reliably leaves in the server log is an out-of-memory error reported in Unknown on line 0, meaning no PHP file was running when it happened. Adjust the log paths to match your server.
grep -E "Allowed memory size of [0-9]+ bytes exhausted .* in Unknown on line 0" \
/var/log/apache2/error.log /var/log/php*-fpm.logA match is a reason to investigate, not proof of compromise.
After a successful attack
Huntress recommends looking for:
- PHP or web server processes starting shells or tools such as
sh,bash,curl,wget,python,cmd.exeorpowershell.exe. - Reconnaissance commands such as
whoami,idoruname -arun by the web server user. - New PHP files in the web root, upload, cache or temporary folders.
- New cron jobs, scheduled tasks or user accounts.
- New outbound connections from web servers to unknown hosts.
Because one of the flaws can leak server memory, rotate passwords, API keys and tokens held by internet-facing PHP servers once they are patched. No official list of attacker IP addresses or file hashes had been published at the time of writing.
What is PHP2Shell?
PHP2Shell is two critical flaws in the core of PHP, the code that handles every web request before an application runs. PHP fixed them on 21 October 2026. Because the flaws sit below the application, even a one-line “Hello World” page on an affected version can be attacked, according to Wiz. No login is needed. The name comes from the exploit Wiz built; it is not an official PHP name.
PHP considers the risk highest for Apache with mod_php, where an attack completes before any application code runs. Remote code execution has also been demonstrated on PHP-FPM.
The two flaws
CVE-2026-109618, out-of-memory corruption. A crafted request can make PHP run out of memory while it is still setting up the request. PHP then abandons the work and cleans up memory that was never properly prepared, which an attacker can turn into code execution. The technical advisory confirms this on Apache with mod_php using default settings.
CVE-2026-109619, stale state. When a request ends abruptly, PHP can leave behind references to memory it has already freed. The next request handled by the same worker uses them. The confirmed paths go through session upload progress, which is on by default, and the fatal error backtraces added in PHP 8.5. The technical advisory confirms code execution on both Apache with mod_php and PHP-FPM.
Is it being exploited?
Early attacks have been reported. Cloudflare says it has seen attack traffic against its customers. A video of a working exploit leaked on 20 October, and community proof-of-concept code is circulating. Treat unofficial exploit repositories as untrusted: some may contain malware. As of 16:30 UTC on 21 October, the flaws were not in the CISA Known Exploited Vulnerabilities catalog.
How PHP is responding
The PHP Foundation calls the time it took to ship a fix “a structural failure”. First signs of the memory problem surfaced in a 2024 audit, and work on the fix stalled repeatedly until the reports in August 2026. The Foundation says it has created an Ecosystem Security Team, hired security staff, commissioned further audits, and is changing how the security team makes decisions. It is asking companies and governments that depend on PHP to fund that work.
Timeline
Times are UTC. Discovery dates come from the PHP Foundation’s account.
- 2026-07-30
2026-07-30
Security firm Calif begins an audit of PHP under the Patch the Planet program.
- 2026-08-11
2026-08-11
Calif reports an unauthenticated remote code execution flaw. OpenAI independently reports the same root cause on the same day.
- 2026-08-24
- 2026-09-18
- 2026-10-20
2026-10-20 · about 15:00 UTC
The CVE numbers leak on forums and social media, with an incorrect score of 10.0. No technical details leak.
2026-10-20 · 19:30 UTC
PHP pre-announces the release and brings it forward from 22 to 21 October.
2026-10-20 · about 20:00 UTC
Calif mistakenly publishes a video of a working exploit. It is deleted, but copies circulate.
- 2026-10-21
2026-10-21 · 03:02 UTC
Cloudflare switches on WAF rules for all plans, including Free, and later reports attack traffic against its customers.
2026-10-21
PHP releases 8.5.12, 8.4.27, 8.3.36 and 8.2.35 and publishes its advisory. Ubuntu, Debian, Arch, cPanel and Plesk ship fixes the same day.
Where the sources differ
Early reporting on these flaws disagrees in places. Here is what each source says and how we read it.
| Question | What the sources say | Our reading |
|---|---|---|
| Which versions are affected | PHP’s CVE records list only 8.2 to 8.5. Wiz, Cloudflare and Sansec say every version since PHP 5.4 is affected, and PHP itself published source backports for 7.4, 8.0 and 8.1. | Treat every version before the fixed releases as affected. |
| Which bug belongs to which CVE | PHP’s advisory places the session upload progress bug under CVE-2026-109619. The table in Wiz’s blog post places it under CVE-2026-109618. | We follow PHP. Both CVEs are fixed by the same release, so it does not change what you do. |
| How severe it is | PHP scores both CVEs 9.2 under CVSS 4.0. Red Hat rates them Important, 8.1 under CVSS 3.1. The 10.0 score that leaked on 20 October was wrong. | The scores use different systems. Treat it as critical for anything serving web traffic. |
| Whether it is being exploited | Cloudflare reports attack traffic and attackers adapting payloads to evade its rules. Hadrian reports exploitation at scale. Huntress had seen none among its customers by the morning of 21 October. | Assume internet-facing servers are being probed. |
Several posts written before PHP’s advisory describe the attack as only the upload progress path, and recommend switching that setting off as a complete fix. PHP’s own advisory says it is not. The Swiss NCSC also notes that a firewall alone is not sufficient.
Recording it for compliance
For most organisations this is an emergency patch of a third-party component. Keep a dated record: an auditor will ask how you learned of it, what you found and how quickly you fixed it.
| Framework | Control | What to record |
|---|---|---|
| ISO 27001:2022 | A.8.8 | Management of technical vulnerabilities. Record the assessment, the systems found and the patch dates. |
| ISO 27001:2022 | A.8.32 | Change management. Record the emergency change and any temporary configuration you applied. |
| ISO 27001:2022 | A.5.25, A.5.26 | Assessment of and response to security events, if you find signs of compromise. |
| SOC 2 | CC7.1 | Identifying newly discovered vulnerabilities. |
| SOC 2 | CC7.2 | Monitoring for anomalies, including the log review. |
| SOC 2 | CC8.1 | Authorising and recording the emergency change. |
Evidence to keep: the date you assessed it, the list of systems and images that run PHP, the versions before and after, the restart times, any temporary settings and when you removed them, the log review, and any secrets you rotated.
For how these controls work day to day, see our guides to ISO 27001 vulnerability management, SOC 2 vulnerability management, and incident response plans for ISO 27001 and SOC 2.
PHP2Shell FAQ
Short answers to the questions we are hearing most. The sections above have the detail and sources.
What is PHP2Shell?
PHP2Shell is the name Wiz gave to an exploit for two critical flaws in the core of PHP, CVE-2026-109618 and CVE-2026-109619. They let an attacker who sends crafted web requests run code on the server or read its memory, without logging in. The flaws are in PHP itself, so an application with no bugs of its own is still exposed.
Which PHP versions fix PHP2Shell?
PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, released on 21 October 2026. PHP 8.1 and older are affected but get no official release, so install a vendor backport or upgrade to PHP 8.2 or later. Distribution packages often keep the old version number, so check the package changelog for the CVE numbers.
Is PHP2Shell being exploited?
Early attacks have been reported. Cloudflare says it has seen attack traffic against its customers and attackers changing their payloads to get past its rules, and a video of a working exploit leaked on 20 October 2026. As of 21 October 2026 the flaws were not in the CISA Known Exploited Vulnerabilities catalog.
Does Cloudflare or another firewall protect me from PHP2Shell?
Only partly. Cloudflare and Akamai block known attacks automatically, and Fastly offers a virtual patch you have to apply, but these rules cover only the attack paths known so far and only traffic that passes through the provider. They buy time. Update PHP anyway.
Is there a workaround if I cannot update PHP yet?
Not a complete one. PHP recommends turning off session.upload_progress.enabled, setting memory_limit to -1 with a container or cgroup memory limit instead, and lowering post_max_size, all in server configuration, then restarting every PHP process. These block the known attack paths only.
Do I need to restart PHP after updating?
Yes. Restart PHP-FPM, Apache and any long-running PHP workers such as queue workers. A process that started before the update keeps running the vulnerable code.
Sources
- PHP security advisory, 21 October 2026Who is at risk, fixed versions and temporary measures.
- GHSA-w8hw-w9fx-j79w (CVE-2026-109618)Technical advisory for the out-of-memory flaw.
- GHSA-6wmf-4rv5-p3rp (CVE-2026-109619)Technical advisory for the stale state flaw.
- PHP Foundation blog, 21 October 2026Disclosure timeline and the Foundation’s security plans.
- Wiz ResearchExploitation research and detection signals.
- php2shell.comWiz’s summary site, with answers to common questions.
- Cloudflare blogWAF rules and observed attack traffic.
- CERT-EU advisory 2026-018Affected versions and recommended measures.
- CrowdStrikeThe log line left by an attack attempt.
- HuntressPost-exploitation behaviour to hunt for.