php2shell: The PHP Bug That Runs Before Your Code Does
On 21 October 2026 PHP shipped fixes for two critical unauthenticated remote code execution flaws, CVE-2026-109618 and CVE-2026-109619, nicknamed php2shell. They live in PHP itself, not in WordPress or Laravel, and they fire while PHP is still setting up the request. CISA added both to its exploited-vulnerabilities list five days later. What the bugs are, in plain terms, who is exposed, why updating the package is not enough, and what to do if you can't patch today.
- #security
- #php
- #vulnerabilities
- #backend
- #devops
Most PHP security advice is about your code. Escape output, use prepared statements, don't unserialize() user input, keep WordPress plugins updated. All good advice. None of it helps this time.
php2shell is a pair of bugs in PHP itself. They trigger while PHP is still preparing the incoming request, before your framework boots and before a single line of your application runs. Your code can be perfect and the server still belongs to someone else.
On 21 October 2026 the PHP project released fixes for both: CVE-2026-109618 and CVE-2026-109619. The PHP security team rates each at CVSS v4.0 9.2. Neither needs a login. And on 26 October, CISA added both to its Known Exploited Vulnerabilities catalog, which is the government's way of saying "this isn't theoretical anymore".
Who is affected
The short answer is: if PHP serves web requests on your server, you're in scope. CISA's alert says the flaws "affect all PHP installations serving web requests", and the advisories list every common way of running PHP:
- Apache with mod_php (the PHP team considers this the highest risk)
- PHP-FPM behind Nginx or Apache
- php-cgi
- FrankenPHP
- LiteSpeed
Fixed versions:
| Branch | Fixed in |
|---|---|
| 8.5 | 8.5.12 |
| 8.4 | 8.4.27 |
| 8.3 | 8.3.36 |
| 8.2 | 8.2.35 |
| 7.4, 8.0, 8.1 | No official release; the PHP team published minimal source backports |
| 7.3 and older | End of life, no fix |
The researchers say the affected code goes back about a decade, to PHP 5.4. It also reaches past "a PHP website": Palo Alto Networks confirmed that PAN-OS and Panorama are affected, which is a reminder that PHP quietly runs inside plenty of appliances too.
What the bugs actually are
You don't need to read PHP's C source to understand the shape of these. Both come down to one uncomfortable idea: PHP's internal bookkeeping goes wrong when a request fails at exactly the wrong moment, and the mess survives long enough for an attacker to use it.
CVE-2026-109618: corruption when memory runs out. PHP sets up a lot of data before your script starts: parsed form fields, uploaded file parts, cookies, session details. If a request is crafted so PHP runs out of memory halfway through that setup, PHP stops. The problem is the cleanup afterwards, which trusts data that was only half built. Half-built data that gets trusted is how memory corruption starts, and memory corruption is how remote code execution starts.
CVE-2026-109619: stale state from a previous request. A PHP worker handles many requests in a row. Some internal state belongs to one request and should be thrown away when it ends. Here, under the right conditions, that state outlives the memory it points to. The next request on the same worker then uses a pointer into memory that's since been reused for something else: a use-after-free. Researchers also showed it could leak memory contents back to the attacker, which helps with the next step.
The detailed write-ups trace the paths through very ordinary features: multipart form parsing, the session upload-progress feature, error backtraces after an out-of-memory failure, and OPcache. Nothing exotic. That's what makes it uncomfortable. These code paths run on almost every PHP server, whether the application uses them or not.
Compare this to the usual PHP vulnerability, which is a bug in one plugin, on sites that installed that plugin. This is the language runtime. It's the difference between a bad lock on one apartment and a bad lock on the building's front door.
How it was found, and how it leaked
The timeline is worth knowing because it shows how fast this kind of bug now moves.
- 19 August: researchers find the first bug. (Credit goes to several teams: the PHP Foundation names Calif, OpenAI and Wiz, and both Calif and Wiz say they used AI models in their research.)
- 20–21 August: working remote code execution against Drupal and WordPress test setups.
- 24 August: reported to PHP.
- 20 October: CVE identifiers and details leak on social media, two days before the planned disclosure.
- 21 October: PHP moves the release forward a day and ships the fixes.
- 26 October: CISA adds both CVEs to its exploited list.
There's an awkward footnote. Amazon reported an exploitation attempt against its honeypots on 17 October, four days before the patch, and said it was unclear how the attacker got the information. Amazon also reported "broad exploitation attempts" after disclosure. So if you're investigating, start looking from mid-October, not from the 21st.
Updating the package is not enough
This catches people every time, so it gets its own heading.
Installing the new PHP package does not patch PHP processes that are already running. PHP-FPM pools, Apache with mod_php and long-lived workers keep running the old code in memory until they restart. You can have 8.4.27 on disk and 8.4.26 answering requests.
After updating:
- Restart every PHP worker: PHP-FPM, Apache, FrankenPHP, LiteSpeed, and any container running PHP.
- Rebuild container images that bundle PHP, and redeploy them. A patched base image does nothing for a container built last month.
- Check the version actually serving traffic, not the one the package manager reports. A one-line script calling
phpversion()behind your real web server, removed afterwards, settles the argument. - Look for PHP you forgot about: admin panels, old marketing sites, monitoring tools, network appliances.
If you can't patch today
Sometimes you can't. Maybe the server runs an old app nobody dares touch, or it's PHP 7.4 with a framework that won't run on 8.x. The advisories offer ways to reduce exposure. None of them make an unpatched install safe.
- Put a WAF in front. CISA says a web application firewall "may provide some protection". Cloudflare shipped rules for the known attack patterns, free tier included, and called them a stopgap only. They only help traffic that actually goes through Cloudflare.
- Turn off session upload progress with
session.upload_progress.enabled=0. Very few applications use it. - On PHP 8.5, turn off fatal error backtraces with
fatal_error_backtraces=0. - Tighten request limits. Reduce
max_input_nesting_leveland cap input variables, multipart parts and upload sizes. If the application doesn't take file uploads, block multipart requests at the proxy. - Isolate it. CISA and NCSC-UK both recommend taking systems offline that can't be fixed. If that's impossible, put them behind a VPN or an allowlist so the internet can't reach them.
There's also advice about running with memory_limit=-1 (enforced so applications can't override it) to avoid the out-of-memory path. Read it carefully before trying it: removing PHP's memory limit just moves the safety net to your container or cgroup memory limit, which turns some attacks into a crash instead of a takeover. That's better, but it's still a crash.
How to tell if someone already got in
Assume probing has happened on anything internet-facing. Things worth looking for, from the CISA and researcher guidance:
- PHP workers starting shells or downloading tools. A PHP-FPM process running
sh,curlorwgetis almost never normal. - Unusual multipart requests followed by memory-limit errors or bursts of 500s.
- Strange
PHPSESSIDcookies in responses: unusually large or malformed ones, especially on pages that don't use sessions. - Unexplained PHP worker crashes and restarts.
One investigation tip from the incident responders: if a server shows signs of probing, capture worker memory before you restart it. A restart is the fix, but it also wipes the evidence. CISA published a SIGMA detection rule for the post-exploitation behaviour, which most SIEMs can import.
The takeaway
php2shell isn't a WordPress problem or a Laravel problem. It sits in PHP's request setup, it runs before your code does, and it touches every way of serving PHP over the web. That means "our application is secure" is the wrong question this time. The right one is "which PHP binary is answering requests on every server we own, and when did that process last restart?"
Patch to 8.5.12, 8.4.27, 8.3.36 or 8.2.35, then restart every worker and rebuild every image, because the package on disk protects nobody while the old process is still running. If you can't patch, treat config changes and WAF rules as a way to buy days, not as a fix, and take anything you truly can't update off the public internet. And since exploitation attempts started before the patch existed, check your logs from the middle of October, not from the day you heard about it.
The deeper lesson is about where security work lives. Most teams spend their attention on their own code and their direct dependencies. The runtime underneath is easy to forget because it rarely needs anything. php2shell is a reminder that "rarely" isn't "never", and that the most important patch of the year can be for something you didn't write and haven't thought about since you installed it.
/share

Kishore K Sharma
Module Lead | Senior Full Stack Engineer | Java · Spring Boot · Distributed Systems · AWS | Building Scalable Cloud-Native Platforms
Available for contract work and remote full-time roles. See what I take on.
/seen in production