← All posts
Web security

PHP2Shell: two unauthenticated RCE flaws in PHP, and what to patch tonight

CVE-2026-109618 and CVE-2026-109619 let an attacker run code on a PHP web server with a single unauthenticated request. Here is the mechanism, the fixed versions, and why mod_php setups are in the most danger.

On 21 October 2026 the PHP project shipped an emergency security release for two critical flaws, tracked as CVE-2026-109618 and CVE-2026-109619 and known together as PHP2Shell. Both allow remote code execution, both need no authentication, and a working exploit has already shown that a single request can trigger the attack. If you run PHP that serves web requests, this is a patch-tonight item. This post explains what the flaws are, what to update to, and how to buy time if you cannot patch immediately.

What the two flaws are

Neither is a logic bug in your code. They are both in how the PHP engine manages memory across a request, which is why every web-facing PHP install is affected regardless of the framework on top.

  • CVE-2026-109618 — RCE via out-of-memory corruption. If PHP hits an out-of-memory condition while request data is only partly initialized, the cleanup that follows can treat that half-built, invalid data as if it were valid. An attacker who can push the worker to that edge can turn the confusion into code execution.
  • CVE-2026-109619 — RCE via stale global state. Internal state that belongs to one request can survive after its memory has been freed. The next request on the same worker process can then use that freed state before it is reset, which is a use-after-free an attacker can steer.

The common thread is a request reaching into memory it should no longer touch. You do not need to understand the internals to act on it; you need to know that the fix is a version bump, not a configuration change.

What to update to

The fixed releases are:

PHP 8.5.12
PHP 8.4.27
PHP 8.3.36
PHP 8.2.35

The PHP security team also published minimal source backports for PHP 7.4, 8.0 and 8.1 for people building from source without a long-term-support vendor. Those versions are otherwise out of support, so if you are still on 8.1 or earlier, this is also the nudge to plan an upgrade to a supported release.

If you install PHP from your Linux distribution rather than from source, your distribution and LTS vendors received the patch before public release. Update through your package manager and check your vendor's advisory, because the version string on a distribution package will not match the numbers above even when the fix is in.

Why mod_php is in the most danger

Every web-serving configuration is affected — PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP, LiteSpeed — but setups running mod_php face the greatest danger, because the PHP engine runs inside the web server's own worker processes. Code execution there is code execution in the process handling everyone's requests. If you are on mod_php and cannot patch within hours, moving to PHP-FPM is a larger change than you want to make tonight, so lean on the interim steps below instead.

If you cannot patch right now

Patching is the real fix. These reduce exposure in the meantime; they do not replace the update.

  1. Put a WAF in front of it. Cloudflare has deployed rules for the known exploit vectors, available to all plans including the free tier. Other WAF vendors are shipping signatures; turn them on.
  2. Take truly unpatchable systems offline. The UK's NCSC has gone as far as advising organizations to consider pulling any system that cannot be fixed quickly. For an internet-facing box with no patch path, that is proportionate.
  3. Watch for the edge conditions. Exploitation drives workers toward out-of-memory and reuse states. Unusual memory pressure, worker crashes and restart storms on a PHP tier are worth alerting on right now.

This was being exploited before it was announced

Amazon's threat intelligence recorded a PHP2Shell exploitation attempt on its honeypot network on 17 October, four days before the public disclosure. How the attacker had exploit details ahead of the announcement is not known. The practical takeaway is that the window where only defenders knew is already closed: treat this as actively exploited and prioritize accordingly.

PHP runs a large share of the web, so "we don't really use PHP" is worth checking rather than assuming. Your WordPress install, your old admin panel, a vendor appliance with a PHP management UI — each is a PHP web server. If you want a habit that keeps this kind of thing from being a surprise, the Daily Adversary drills the instinct for reading an advisory and asking the one question that matters: can this be reached without logging in? Here, the answer is yes.

Web securityThreats
Why the company threatens the person who reported its bugPolicy

When responsible disclosure gets you a lawyer's letter

Why a company threatens the person who reported its bug, why the researcher is still partly right, and the procedural fix on both sides that makes the letter unnecessary.

Why backups get deleted firstThreats

What is ransomware? How it gets in, what it does, and what actually stops it

Ransomware as an operator sees it: the entry points, the days before encryption, why backups get deleted first, and the controls that stop it in cost order.

Zero days for the vendor to fix it. The name tells you what to do.Threats

What is a zero-day? And why the name tells you what to do

A zero-day is a vulnerability the vendor has had zero days to fix. Here is how the term splits three ways, how the clock runs, and what a defender can do with no patch.