PHP2Shell: When Two Critical CVEs Put PHP Servers at Risk
Two memory-safety flaws in PHP's core engine, an out-of-memory corruption and a stale global state use-after-free, could be triggered during request handling. Researchers demonstrated unauthenticated remote code execution against WordPress, Drupal and Joomla, and there were reports of exploitation against internet-facing firewall infrastructure.
medium.com
Published on medium.com
PHP
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
PHP is one of the most widely used server-side programming languages and powers a significant portion of the web, including platforms such as WordPress, Drupal and Joomla. According to Wiz Research, cited in the write-up, PHP powers approximately 70% of websites.
On 21 October 2026 the PHP development team released emergency security updates addressing two critical vulnerabilities, collectively referred to as PHP2Shell. Both received a CVSS v4.0 score of 9.2. What made the issue particularly concerning is that the flaws existed within PHP's core engine rather than in a particular framework or application, so any PHP-powered platform could be exposed depending on its runtime and deployment configuration.

Setup
The write-up does not describe a hands-on lab, accounts, roles or tooling. The work was carried out by Wiz Research with assistance from AI models during security research. The demonstration targets were WordPress, Drupal and Joomla, which the researchers used to demonstrate unauthenticated remote code execution. The write-up stresses that these were demonstration targets, not the only affected applications.
Two memory-management concepts are needed to follow the analysis:
- Out-of-memory (OOM): this happens when a program cannot allocate the memory it needs to continue executing an operation.
- Use-after-free: a memory-management vulnerability where a program attempts to access memory that has already been released.
Finding it
The first vulnerability was discovered on 19 August 2026. Researchers subsequently demonstrated remote code execution against WordPress and Drupal before reporting their findings to the PHP security team on 24 August. The PHP team then worked on a coordinated fix.
On 20 October, information about the upcoming vulnerabilities began circulating publicly before the planned disclosure, and PHP moved its security release forward to 21 October.

The write-up frames the discovery as an example of how AI-assisted security research can uncover vulnerabilities that have remained hidden in widely used software for years.
Exploitation
The write-up describes the mechanisms behind the two CVEs rather than reproducing a request-by-request exploitation session. No HTTP requests, payloads or commands are shown in the report.
Step 1: CVE-2026-109618, out-of-memory corruption
PHP uses an internal mechanism called longjmp() to interrupt execution when certain fatal errors, including out-of-memory conditions, occur. The problem was that this interruption could happen while PHP was still initializing internal request data. When PHP subsequently performed request cleanup, some routines could access memory that was not properly initialized. An attacker could manipulate this condition to corrupt memory and eventually achieve remote code execution.
Step 2: CVE-2026-109619, stale global state
This vulnerability involved PHP retaining references to memory belonging to a previous request. Even after that memory had been freed, certain internal global variables could still point to it. When another request was processed, PHP could interact with this stale memory before the relevant state was properly initialized. This created a use-after-free condition that researchers demonstrated could be developed into remote code execution.
The important distinction is that these were two different vulnerability mechanisms, although both involved PHP's memory-management and request-handling processes.
Root cause
The root cause in both cases sits in PHP's core engine, in how request state is initialised, interrupted and cleaned up:
- In CVE-2026-109618, a fatal error such as an out-of-memory condition triggers
longjmp()while request data is still being initialised. Cleanup routines then operate on memory that was never properly initialised, which an attacker can steer into memory corruption. - In CVE-2026-109619, internal global variables can still reference memory from a previous request after that memory has been freed. A subsequent request can touch this stale memory before the relevant state is properly initialised, producing a use-after-free.
Because the flaws live in the runtime rather than in application code, updating application code or installing a Web Application Firewall (WAF) is not a complete fix. The write-up states that PHP's security advisory explicitly says there are no complete mitigations that replace updating.
Impact
The researchers demonstrated unauthenticated remote code execution against WordPress, Drupal and Joomla. Other PHP-powered platforms could also be affected depending on their PHP runtime and deployment configuration.
Successful exploitation could allow an attacker to:
- Execute arbitrary commands on a vulnerable server.
- Access sensitive information stored in process memory.
- Steal credentials, authentication tokens and API keys.
- Establish persistence and potentially move further into an organisation's infrastructure.
There have also been reports of exploitation against internet-facing firewall infrastructure. A report published by SecurityWeek on 28 October described attackers chaining PHP2Shell with a Linux privilege-escalation vulnerability to compromise firewall infrastructure associated with a US government-affiliated organisation.
Fix
On 21 October the PHP development team released security updates. The write-up shows the patched versions in an image, so the specific version numbers are not stated here.

PHP administrators were advised to upgrade their installations. Beyond upgrading, organisations should:
- Identify all PHP installations, including those running in containers.
- Check the PHP version used by web servers and PHP-FPM workers.
- Upgrade to a patched, supported release.
- Restart affected services and workers.
- Investigate logs for suspicious requests and possible exploitation.
- Review unsupported PHP versions and plan migrations.
The write-up points to the PHP Security Advisory of 21 October 2026 as the official technical reference.
Variants to test
The write-up does not propose variants.
What happened, in plain words
In October 2026 the people who maintain PHP, a programming language that runs a very large share of the world's websites, had to rush out emergency fixes for two serious security holes. Together these holes are nicknamed PHP2Shell. Both were rated 9.2 out of 10 on a scale called CVSS v4.0, which is a standard way of saying how bad a security problem is. A score that high means the problem is critical.
The worrying part is where the holes lived. They were not in a plugin, a theme or one particular website-building tool. They were inside PHP itself, the engine that runs underneath everything. That means any website built on PHP could be exposed, depending on how that website's server is set up.
This article walks through what the two holes were, how researchers found them, what an attacker could do with them, and what to do about them. No security background is needed: every term is explained as it comes up.

Photo by Lautaro Andreani on Unsplash
The background: what PHP is and why it matters
When you open a website, your browser asks a computer somewhere else, called a server, for a page. That server often runs a program that builds the page on the spot: it might look up your account, fetch today's news, or fill in a shopping basket. PHP is one of the most common languages used to write those programs. It is the engine behind well-known website platforms such as WordPress, Drupal and Joomla.
According to Wiz Research, cited in the write-up, PHP powers approximately 70% of websites. Think of it like the plumbing in a building: most visitors never see it, but a fault in the pipes affects every tap in the building at once. That is why a flaw in PHP's core engine is far more serious than a flaw in one website's custom code.
On 21 October 2026, the PHP development team released emergency security updates addressing two critical vulnerabilities:

Both vulnerabilities received a CVSS v4.0 score of 9.2.
What makes this particularly concerning is that the vulnerabilities existed within PHP's core engine, rather than being restricted to a particular PHP framework or application.
How the two vulnerabilities worked
Before the details, two ideas about computer memory need to be clear. Memory is the workspace a program uses while it runs, like a desk covered in notes. When a program needs space, it asks the operating system for some, and when it is finished it hands the space back.
- Out-of-memory (OOM): this happens when a program cannot allocate the memory it needs to continue executing an operation. Picture a desk so covered in paper that there is nowhere to put the next document.
- Use-after-free: a memory-management vulnerability where a program attempts to access memory that has already been released. Picture writing a note on a sheet of paper, throwing the sheet away, and then later reading from the bin as if the note were still there. Someone else may have taken that sheet and written something new on it, so what you read is no longer what you wrote.
Both of these are memory-safety problems. They matter because, in the wrong hands, they can let an attacker change what a program does rather than just make it crash.
CVE-2026-109618: out-of-memory corruption
A CVE is a public catalogue number for a known security flaw, so people around the world can refer to the same problem by the same name.
PHP uses an internal mechanism called longjmp() to interrupt execution when certain fatal errors, including out-of-memory conditions, occur.
In plain words: when something goes badly wrong mid-task, PHP needs a way to stop what it is doing and jump back to a safe point, a bit like a fire alarm that makes everyone drop what they are holding and leave the building. longjmp() is that jump.
The problem was that this interruption could happen while PHP was still initializing internal request data.
A request is a single visit: your browser asks for a page, and the server prepares an answer. Initialising request data means setting up the notes for that visit before any work begins. The flaw was that the alarm could go off while the desk was still being set up.
When PHP subsequently performed request cleanup, some routines could access memory that was not properly initialized.
Cleanup is what happens after the visit: the desk is cleared for the next person. If the desk was never properly set up, the person clearing it may pick up notes that were never written, or notes left by someone else.
An attacker could manipulate this condition to corrupt memory and eventually achieve remote code execution.
Remote code execution, often shortened to RCE, means an attacker can make the server run commands of their choosing from a distance, without ever logging in. It is the worst outcome for a server-side flaw, because from there the attacker can do almost anything the server is allowed to do.
CVE-2026-109619: stale global state
This vulnerability involved PHP retaining references to memory belonging to a previous request.
A reference is a pointer, like a label on a drawer saying what is inside. Global state means information shared across the whole program rather than kept inside one small task. The flaw was that some of these shared labels still pointed at the previous visitor's drawer after that drawer had been emptied and handed back.
Even after that memory had been freed, certain internal global variables could still point to it.
When another request was processed, PHP could interact with this stale memory before the relevant state was properly initialized.
So the next visitor's request could end up reading leftovers from the previous visitor, before the desk had been properly prepared for them. This is exactly the use-after-free pattern described above.
This created a use-after-free condition that researchers demonstrated could be developed into remote code execution.
The important distinction is that these were two different vulnerability mechanisms, although both involved PHP's memory-management and request-handling processes. One is about an interruption arriving too early; the other is about old pointers surviving into a new request. They are separate bugs with separate mechanisms, even though they share a theme.
What an attacker could actually do
The researchers demonstrated unauthenticated remote code execution against:
- WordPress
- Drupal
- Joomla
Unauthenticated means no username or password was needed. The attacker does not have to be a registered user of the site; anyone who can reach the server can try.
However, these were demonstration targets, not the only affected applications. The researchers used three popular platforms to prove the point. Other PHP-powered platforms could also be affected depending on their PHP runtime and deployment configuration. The runtime is the PHP engine installed on the server, and the deployment configuration is how that server is arranged: which version of PHP it runs, how the web server hands requests to it, and so on.
Successful exploitation could allow an attacker to:
- Execute arbitrary commands on a vulnerable server. Arbitrary means any command the attacker likes, not just the ones the website intended to offer.
- Access sensitive information stored in process memory. While a program runs, it holds things like database passwords and session details in memory; a memory flaw can expose them.
- Steal credentials, authentication tokens and API keys. A credential is a username and password. A token is a short piece of text that proves you are already logged in, a bit like a wristband at an event: show it and you are let back in without queueing again. An API key is a secret string that lets one program talk to another service on your behalf, like a spare key left with a neighbour.
- Establish persistence and potentially move further into an organization's infrastructure. Persistence means leaving something behind so the attacker can return later, like a copied key. Infrastructure means the wider set of servers and services an organisation runs.
There have also been reports of exploitation against internet-facing firewall infrastructure. A firewall is a device or program that filters network traffic, deciding what is allowed in and out. Internet-facing means it can be reached from the public internet.
For example, a report published by SecurityWeek on October 28 described attackers chaining PHP2Shell with a Linux privilege-escalation vulnerability to compromise firewall infrastructure associated with a US government-affiliated organization
Chaining means using one flaw to set up another. Privilege escalation means going from a low level of permission to a higher one, like a visitor finding a way into the staff-only corridor. The write-up cites a SecurityWeek report describing this as a real-world case.
How the flaws were discovered
This is another particularly interesting part of the story.
Wiz research discovered the vulnerabilities with assistance from AI models during security research. AI models here means machine-learning systems used as research assistants, for example to help spot patterns or generate ideas to test. The write-up frames this as an example of how AI-assisted security research can uncover vulnerabilities that have remained hidden in widely used software for years.
The first vulnerability was discovered on August 19, 2026. Researchers subsequently demonstrated remote code execution against WordPress and Drupal before reporting their findings to the PHP security team on August 24.
The gap between discovery and reporting is normal practice: researchers first confirm the problem is real and reproducible, then tell the maintainers privately so a fix can be prepared before the details become public.
The PHP team worked on developing a coordinated fix. Coordinated means the maintainers prepare the patch and plan the announcement together, so that defenders can update at the same time as the flaw becomes known.
On October 20, information about the upcoming vulnerabilities began circulating publicly before the planned disclosure. Disclosure is the moment the details are made public. When word leaks early, the plan changes: attackers may learn about the flaw before defenders can patch.
PHP subsequently moved its security release forward to October 21. Releasing early is a trade-off: the fix arrives sooner, but with less warning for the people who have to install it.
How it was fixed
On October 21, the PHP development team released security updates.
The patched versions were:

The write-up shows the patched versions in an image, so the specific version numbers are not stated here. The practical instruction is the same either way: PHP administrators were advised to upgrade their installations.
Importantly, simply updating application code or installing a Web Application Firewall (WAF) is not a complete fix. The vulnerability exists in the PHP runtime itself. A WAF sits in front of a website and inspects incoming traffic, blocking requests that look malicious, like a security guard at the door. But if the flaw is in the engine room, a guard at the door cannot fix it. PHP's security advisory explicitly states that there are no complete mitigations that replace updating.
Organizations should also:
- Identify all PHP installations, including those running in containers. A container is a packaged, self-contained way of running software; it is easy to forget that a container has its own copy of PHP inside it.
- Check the PHP version used by web servers and PHP-FPM workers. PHP-FPM is a common component that runs PHP processes on behalf of the web server; each worker is one of those processes.
- Upgrade to a patched, supported release. Supported means the maintainers still issue security fixes for that version.
- Restart affected services and workers. A running program keeps using the old code until it is restarted, so the update only takes effect after a restart.
- Investigate logs for suspicious requests and possible exploitation. Logs are the records a server keeps of what it was asked to do; they are the closest thing to a CCTV recording.
- Review unsupported PHP versions and plan migrations. A migration is the planned move from an old version to a new one.
Official technical reference: PHP Security Advisory, 21 October 2026.
Glossary
- API key: a secret string that lets one program access another service on your behalf.
- Authentication token: a short piece of text proving you are already logged in, so you do not have to send your password every time.
- Chaining: using one vulnerability to enable another.
- Container: a packaged, self-contained way of running software, including its own copy of the runtime.
- Coordinated fix: a patch prepared and announced together with the maintainers so defenders can update in time.
- Credential: a username and password, or similar proof of identity.
- CVE: a public catalogue number for a known security vulnerability.
- CVSS v4.0: a standard scoring system for the severity of a vulnerability; 9.2 is a critical score.
- Deployment configuration: how a server is arranged, including which runtime version it uses and how requests reach it.
- Disclosure: the moment details of a vulnerability are made public.
- Firewall: a device or program that filters network traffic.
- Global state: information shared across a whole program rather than kept inside one task.
- Initialisation: setting up a program's data before it starts work.
- Internet-facing: reachable from the public internet.
longjmp(): an internal mechanism PHP uses to jump out of execution when a fatal error occurs.- Logs: records a server keeps of the requests it received.
- Memory: the workspace a running program uses for its data.
- Migration: a planned move from one software version to another.
- Out-of-memory (OOM): a condition where a program cannot get the memory it needs to continue.
- Persistence: an attacker's ability to keep returning to a compromised system.
- PHP: a widely used server-side programming language.
- PHP-FPM: a component that runs PHP processes for a web server.
- Privilege escalation: gaining a higher level of permission than you started with.
- Reference: a pointer to a location in memory.
- Remote code execution (RCE): making a server run commands of the attacker's choosing from a distance.
- Request: one visit from a browser to a server asking for something.
- Runtime: the engine that executes a program, here the installed PHP itself.
- Server: a computer that answers requests from browsers and other programs.
- Supported release: a version for which the maintainers still issue security fixes.
- Unauthenticated: possible without logging in.
- Use-after-free: a memory flaw where a program accesses memory it has already released.
- WAF (Web Application Firewall): a filter in front of a website that blocks traffic that looks malicious.
- Worker: one of the processes a server runs to handle requests.