Konfirmity
All security advisories

//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
  1. Are you affected?
  2. What to do
  3. Patched versions
  4. Check your version
  5. If you cannot update today
  6. Automatic protections
  7. Signs of compromise
  8. What is PHP2Shell?
  9. Timeline
  10. Where the sources differ
  11. Recording it for compliance
  12. FAQ
  13. Sources

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 now

    Update 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 now

    These 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 needed

    Confirm 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 needed

    Ask 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 needed

    These 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 risk

    PHP 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.

  1. 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 check
  2. Update 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 versions
  3. Restart 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.
  4. 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.
  5. 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

Affected and fixed PHP versions by branch
BranchAffectedFixed in
8.58.5.11 and earlier8.5.12
8.48.4.26 and earlier8.4.27
8.38.3.35 and earlier8.3.36
8.28.2.34 and earlier8.2.35
8.1 and olderAll versionsNo 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

Patched operating system and image versions
SoftwareFixed inSource
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.1Ubuntu CVE tracker
Debian 13 trixiephp8.4 8.4.27-1~deb13u1DSA-6574-1
Debian 12 bookwormphp8.2 8.2.35-1~deb12u1DLA-4848-1
Arch Linuxphp 8.5.12-1Arch 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 tagsdocker-library/php #1694
Windows builds (windows.php.net)8.5.12, 8.4.27, 8.3.36, 8.2.35PHP 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

Patched hosting platforms
PlatformFixed inSource
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.35EasyApache 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.35Plesk 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 automaticallyGoogle Cloud blog
Laravel VaporCustom and Docker runtimes must be rebuilt.Native runtimes for PHP 8.3 and laterLaravel blog

Not yet fixed

Platforms without a released fix
SoftwareStatusSource
Red Hat Enterprise LinuxRated Important. No fixed package listed yet.Red Hat CVE page
Amazon Linux 2 and 2023Pending fix. No fix planned for the php8.1 package on Amazon Linux 2023.Amazon Linux security center
SUSE Linux EnterprisePending. Updated packages are in testing.SUSE CVE page
FedoraUpdates submitted and in testing.Red Hat Bugzilla
Debian unstableStill on php8.4 8.4.26.Debian security tracker
Remi’s repositoryNo update on 21 October. PHP suggests distribution packages or building from source.PHP advisory
HomebrewFormulae still on 8.5.11, 8.4.26, 8.3.35 and 8.2.34.Homebrew php formula
Laravel Forge, Ondřej Surý PPAPHP 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

Shell
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_php

Compare 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.

Debian and Ubuntu
zgrep -E "CVE-2026-10961[89]" /usr/share/doc/php*-common/changelog.Debian.gz
RHEL, Fedora and derivatives
rpm -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
<?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
FPM pool
php_admin_flag[session.upload_progress.enabled] = off
php_admin_value[memory_limit] = -1
php_admin_value[post_max_size] = 8M
Apache with mod_phpAdd to the server or virtual host configuration
Apache
php_admin_flag session.upload_progress.enabled off
php_admin_value memory_limit -1
php_admin_value post_max_size 8M
php.iniFor other setups. Check that no pool or virtual host overrides it
php.ini
session.upload_progress.enabled = 0
memory_limit = -1
post_max_size = 8M
  • Use post_max_size = 32M if your application accepts uploads, and keep upload_max_filesize below it.
  • On PHP 8.5, also set fatal_error_backtraces to 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_AS or RLIMIT_DATA: PHP says these can trigger the flaw.
  • Setting these with ini_set() or a .user.ini file 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
nginx
if ($http_content_type ~* "multipart/form-data") { return 403; }
ApacheInside the <Directory> block for your web root. Requires mod_rewrite
Apache
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

Automatic and optional protections announced by security providers
ProviderWhat it doesWhat you need to doSource
Cloudflare WAFManaged 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 ProtectorAdaptive 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 WAFA 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 SnortIntrusion 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 VIPAutomattic says every site on its platform was protected before the release.Nothing.WordPress VIP notice
CrowdStrike FalconDetects 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 SensorA 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 PHPSESSID cookies 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.

Shell
grep -E "Allowed memory size of [0-9]+ bytes exhausted .* in Unknown on line 0" \
  /var/log/apache2/error.log /var/log/php*-fpm.log

A 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.exe or powershell.exe.
  • Reconnaissance commands such as whoami, id or uname -a run 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.

  1. 2026-07-30

    Security firm Calif begins an audit of PHP under the Patch the Planet program.

    PHP Foundation

  2. 2026-08-11

    Calif reports an unauthenticated remote code execution flaw. OpenAI independently reports the same root cause on the same day.

    PHP Foundation

  3. 2026-08-24

    Wiz Research reports further ways to attack the same flaws.

    PHP Foundation

  4. 2026-09-18

    OpenAI reports further attack paths.

    PHP Foundation

  5. 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.

    PHP Foundation

  6. 2026-10-20 · 19:30 UTC

    PHP pre-announces the release and brings it forward from 22 to 21 October.

    PHP advisory

  7. 2026-10-20 · about 20:00 UTC

    Calif mistakenly publishes a video of a working exploit. It is deleted, but copies circulate.

    PHP Foundation

  8. 2026-10-21 · 03:02 UTC

    Cloudflare switches on WAF rules for all plans, including Free, and later reports attack traffic against its customers.

    Cloudflare blog

  9. 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.

    PHP advisory

Where the sources differ

Early reporting on these flaws disagrees in places. Here is what each source says and how we read it.

Points where sources disagree
QuestionWhat the sources sayOur reading
Which versions are affectedPHP’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 CVEPHP’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 isPHP 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 exploitedCloudflare 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.

Controls to record this event against
FrameworkControlWhat to record
ISO 27001:2022A.8.8Management of technical vulnerabilities. Record the assessment, the systems found and the patch dates.
ISO 27001:2022A.8.32Change management. Record the emergency change and any temporary configuration you applied.
ISO 27001:2022A.5.25, A.5.26Assessment of and response to security events, if you find signs of compromise.
SOC 2CC7.1Identifying newly discovered vulnerabilities.
SOC 2CC7.2Monitoring for anomalies, including the log review.
SOC 2CC8.1Authorising 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