**PHP2Shell (CVE-2026–109618 and CVE-2026–109619): Critical PHP RCE Vulnerability and Patch Guide**
Two memory-management flaws in the PHP engine could leave invalid internal state after abnormal request termination, allowing an attacker to corrupt memory and execute code as the PHP worker. The text claims some attack paths can operate before application-level logic executes, with Apache mod_php deployments especially exposed.
Cybersecurity
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: PHP2Shell and the PHP engine itself
PHP2Shell is the name given to a pair of vulnerabilities in the PHP core, tracked as CVE-2026-109618 and CVE-2026-109619. They were disclosed on 21 October 2026 and affect the PHP engine rather than any particular plugin or application. That distinction matters: a WordPress, Drupal or Joomla installation can be fully up to date and still be exposed if the PHP runtime underneath it is vulnerable. The same applies to containers, hosting environments, appliances and applications that bundle their own PHP runtime.
The two bugs both concern PHP memory handling when requests terminate unexpectedly. An abnormal termination can leave invalid internal state behind, and a subsequent request can then be used to exploit that state. The first vulnerability involves improper handling of memory after an out-of-memory condition. The second involves references to memory that has already been freed but remains reachable through stale internal state. Combined, the weaknesses can allow memory corruption and code execution with the privileges of the PHP worker.
The write-up also frames the disclosure as an example of AI-assisted vulnerability research shortening the path from a long-standing, hard-to-exploit weakness to a practical attack chain.
Setup: versions and preconditions
According to the advisory coverage cited in the article, PHP releases from 5.4 through 8.5 were affected by at least one of the two vulnerabilities. The primary patched releases are:
| Branch | Fixed release |
|---|---|
| 8.5 | 8.5.12 |
| 8.4 | 8.4.27 |
| 8.3 | 8.3.36 |
| 8.2 | 8.2.35 |
Organisations on older, end-of-life branches are advised to look for supported vendor backports or to migrate to a supported release. Because PHP can be installed through operating-system packages, custom builds, container images or vendor-managed applications, checking the command-line PHP version alone can miss a vulnerable web-facing installation.
The article characterises the issue as unauthenticated remote code execution: no login is required to reach the vulnerable code path. Apache deployments using mod_php were identified as especially exposed to the demonstrated request-startup path.
Finding it: abnormal termination and stale state
The starting observation is that both bugs are triggered when a request terminates unexpectedly. Instead of the engine cleaning up fully, internal state can be left invalid, and that invalid state persists into later requests handled by the same worker. The article describes the two mechanisms separately:
- Improper handling of memory after an out-of-memory condition.
- References to memory that has already been freed, still accessible through stale internal state.

The image sits alongside the description of the two bugs and illustrates the shared theme: both involve PHP memory handling when requests terminate unexpectedly, potentially leaving invalid internal state that can be exploited by subsequent requests.
What made this notable is that these were long-standing memory-management weaknesses. The article's point is that a bug being difficult to exploit is not the same as it being harmless; once a reliable path exists, the exposure changes.
Exploitation: the chain
PHP2Shell is not a single request. The article describes it as a multi-stage chain, and the stages are worth separating because each one depends on the previous one succeeding.
Step 1: trigger an abnormal request termination
The attacker causes a request to end abnormally. This is the precondition for everything that follows: it is what leaves the worker's internal state invalid.
Step 2: exploit the stale memory state
A subsequent request reaches the invalid state left behind by the terminated one. Depending on which of the two bugs is in play, this is either memory mishandled after an out-of-memory condition or a reference to freed memory that is still reachable.
Step 3: overcome memory-layout protections
The chain includes obtaining information that helps defeat memory-layout protections. The article does not detail the specific disclosure primitive or the exact bytes involved.
Step 4: turn corruption into code execution
The resulting memory corruption is used to achieve code execution under the privileges of the PHP worker.
One property of the chain is called out specifically: some attack paths can operate before application-level logic executes. That is why the request-startup path on Apache with mod_php was identified as especially exposed in the demonstrated attack.
Timeline
The article lays out the disclosure and exploitation sequence as follows:
- August 2026: researchers developed and reported exploitable attack paths involving PHP memory-management weaknesses.
- 17 October 2026: Amazon's MadPot honeypots recorded the first known exploitation attempt reported in the article.
- 20 October 2026: the CVE identifiers leaked publicly, prompting emergency advisories.
- 21 October 2026: PHP released patched versions, and public proof-of-concept activity emerged.
- 22 to 23 October 2026: reported scanning and exploitation attempts escalated, with researchers describing improved exploitation techniques.
The ordering is the lesson: exploitation attempts were recorded before public disclosure, and the pace increased once proof-of-concept code was public.
Impact
Because the bugs sit in the engine, the impact is bounded by the worker's privileges and by the deployment's configuration, server architecture, permissions and which exploitation path succeeds. The article lists what the vulnerabilities can potentially enable:
- executing commands with the web worker's privileges;
- accessing application configuration and secrets;
- exposing credentials, session tokens or API keys;
- establishing persistence or moving toward other internal systems.
The article is careful to say that the precise impact depends on those factors, and that some observed activity was associated with botnet operations while other activity appeared more targeted.
Threat activity and detection
Exploitation attempts began before public disclosure and expanded rapidly once proof-of-concept code became available. Observed activity included vulnerability scanning, attempts to deploy web shells, credential theft and malware delivery.
Even where successful compromise is not confirmed, repeated probing of vulnerable systems warrants investigation. The article points to the following things to review on internet-facing PHP services:
- suspicious multipart requests;
- unexpected worker crashes;
- unusual PHP session cookies;
- unauthorised child processes;
- unexpected outbound connections.
Because the vulnerabilities can expose sensitive information, incident responders should also consider whether secrets need to be rotated.
Fix: patching and mitigation
Upgrading to a fixed release and restarting PHP workers are the primary remediation steps. Configuration changes and WAF rules add protection but should not replace patching. The recommended actions are:
- Upgrade PHP: deploy a fixed release or a verified vendor-backported package.
- Restart all workers: restart PHP-FPM pools, Apache and other affected services so the patched code is actually loaded.
- Verify the web-facing runtime: check the version used by the application server, not just the CLI binary.
- Inventory all deployments: review virtual machines, containers, appliances and bundled PHP installations.
- Hunt for suspicious activity: review logs and endpoint telemetry for signs of exploitation, credential exposure or persistence.
- Rotate potentially exposed secrets: prioritise credentials accessible to vulnerable workers.
- Apply temporary controls: use appropriate WAF rules, restrict unnecessary exposure and isolate systems that cannot be patched promptly.
Variants to test
The article does not publish request payloads, so the following are directions suggested by its own detection guidance rather than reproductions of the exploit.
- Inventory drift between CLI and web runtime. Compare the PHP version reported by the command-line binary with the version the application server actually loads. A positive result is a web-facing runtime older than the fixed releases in the table above, even where the CLI reports a patched version.
- Container and appliance images. Scan images before deployment and check running workloads separately. A positive result is an image or running container carrying an affected PHP version, or a running workload whose patched image was never actually restarted into.
- Worker crash telemetry. Look for unexpected PHP worker crashes correlated with unusual request patterns. A positive result is repeated crashes on the same pool followed by requests that behave differently.
- Multipart request anomalies. Review logs for suspicious multipart requests against PHP endpoints. A positive result is multipart traffic that does not match normal application behaviour and lines up in time with worker restarts or crashes.
- Session cookie anomalies. Look for unusual PHP session cookies. A positive result is session identifiers that do not correspond to any legitimate login flow.
- Process and network anomalies. Check for unauthorised child processes spawned by the web worker and for unexpected outbound connections. A positive result is a shell or interpreter process parented by the web server, or egress to an address the application has no reason to contact.
- Web shell and credential hunting. Given the observed attempts to deploy web shells and steal credentials, search the web root for newly written files and review accessible configuration and secret stores. A positive result is an unfamiliar executable file in a writable directory, or evidence that secrets reachable by the worker were read.
For the full timeline, vulnerability details, exploitation research and patching recommendations, the article points to Loginsoft's original post.
What happened, in plain words
In October 2026, two serious security flaws were found in PHP, the software that runs a very large share of the world's websites. The flaws were given the names CVE-2026-109618 and CVE-2026-109619, and together the pair is nicknamed PHP2Shell. They were disclosed on 21 October 2026.
The important part is where the flaws live. They are not in a plugin, a theme or a particular website program. They are in the PHP engine itself, the layer that every PHP-based site sits on top of. That means a WordPress, Drupal or Joomla site can be completely up to date and still be exposed, because the problem is underneath it. The same goes for containers, hosting environments, appliances and any application that ships its own copy of PHP.
Both flaws are about how PHP handles its memory when a request ends unexpectedly. A request is simply a browser (or a scanner, or an attacker's tool) asking the web server for something. When such a request stops in an abnormal way, PHP can be left holding internal state that is no longer valid. A later request can then be used to take advantage of that leftover state. Put together, the two weaknesses can let an attacker corrupt memory and run their own code with the same powers as the PHP worker, the process that handles requests on the server.
The write-up also presents the disclosure as an example of AI-assisted vulnerability research: work that used to take a long time can now turn a long-standing, hard-to-exploit weakness into a practical attack chain much faster.
The basics you need before the details
A few everyday comparisons will make the rest of this easier.
- Server and worker. Think of a restaurant. The server is the building; a worker is one waiter who takes an order, goes to the kitchen and comes back. PHP workers handle web requests one after another. If a waiter drops a tray and leaves the mess on the floor, the next waiter can trip over it. That is roughly what "invalid internal state left behind by a terminated request" means.
- Memory. The worker's short-term workspace: notes it keeps while serving a request. If those notes are wrong, later work goes wrong too.
- Remote code execution (RCE). The attacker can make the server run commands of their choosing, without ever sitting at its keyboard. It is the difference between someone reading over your shoulder and someone typing on your machine.
- Unauthenticated. No username or password is needed. The attacker does not have to log in first.
- CVE. A public catalogue number for a known vulnerability, so everyone can refer to the same flaw unambiguously.
- Patch. A fixed version of the software. Installing it is the cure; everything else is a sticking plaster.
Context: PHP2Shell and the PHP engine itself
PHP2Shell is the name given to a pair of vulnerabilities in the PHP core, tracked as CVE-2026-109618 and CVE-2026-109619. They were disclosed on 21 October 2026 and affect the PHP engine rather than any particular plugin or application. That distinction matters: a WordPress, Drupal or Joomla installation can be fully up to date and still be exposed if the PHP runtime underneath it is vulnerable. The same applies to containers, hosting environments, appliances and applications that bundle their own PHP runtime.
The two bugs both concern PHP memory handling when requests terminate unexpectedly. An abnormal termination can leave invalid internal state behind, and a subsequent request can then be used to exploit that state. The first vulnerability involves improper handling of memory after an out-of-memory condition. The second involves references to memory that has already been freed but remains reachable through stale internal state. Combined, the weaknesses can allow memory corruption and code execution with the privileges of the PHP worker.
The write-up also frames the disclosure as an example of AI-assisted vulnerability research shortening the path from a long-standing, hard-to-exploit weakness to a practical attack chain.
Setup: versions and preconditions
According to the advisory coverage cited in the article, PHP releases from 5.4 through 8.5 were affected by at least one of the two vulnerabilities. The primary patched releases are:
| Branch | Fixed release |
|---|---|
| 8.5 | 8.5.12 |
| 8.4 | 8.4.27 |
| 8.3 | 8.3.36 |
| 8.2 | 8.2.35 |
A branch here is a major version line, such as 8.4. Each line gets its own small fix release, so you do not have to jump to the newest line to be safe: you just need the fixed release on the line you already run. The table is read like a shopping list: find your branch on the left, install the version on the right.
Organisations on older, end-of-life branches are advised to look for supported vendor backports or to migrate to a supported release. A backport is when the vendor takes the fix written for a newer version and adapts it to an older one, so you can stay where you are and still be protected. End-of-life means the branch no longer receives fixes at all, so staying there is a dead end.
Because PHP can be installed through operating-system packages, custom builds, container images or vendor-managed applications, checking the command-line PHP version alone can miss a vulnerable web-facing installation. In plain terms: the version you see when you type a command on the server may not be the version the website actually uses. There can be two copies, and only one of them faces the internet.
The article characterises the issue as unauthenticated remote code execution: no login is required to reach the vulnerable code path. Apache deployments using mod_php were identified as especially exposed to the demonstrated request-startup path. Apache is a common web server program, and mod_php is a way of plugging PHP directly into it. The article singles out that combination as the most exposed in the attack it describes.
Finding it: abnormal termination and stale state
The starting observation is that both bugs are triggered when a request terminates unexpectedly. Instead of the engine cleaning up fully, internal state can be left invalid, and that invalid state persists into later requests handled by the same worker. The article describes the two mechanisms separately:
- Improper handling of memory after an out-of-memory condition.
- References to memory that has already been freed, still accessible through stale internal state.
An out-of-memory condition is what it sounds like: the worker asks for more memory than it is allowed and the request dies. The first bug is about what happens to the leftovers after that death. The second is about use-after-free: memory that has been handed back, but which something still points at. Think of a hotel room that has been checked out and cleaned, while an old key card still opens the door.

The image sits alongside the description of the two bugs and illustrates the shared theme: both involve PHP memory handling when requests terminate unexpectedly, potentially leaving invalid internal state that can be exploited by subsequent requests.
What made this notable is that these were long-standing memory-management weaknesses. The article's point is that a bug being difficult to exploit is not the same as it being harmless; once a reliable path exists, the exposure changes. A lock that is hard to pick is still a lock that someone may eventually pick, and once one person publishes how, everyone can copy it.
Exploitation: the chain
PHP2Shell is not a single request. The article describes it as a multi-stage chain, and the stages are worth separating because each one depends on the previous one succeeding. A chain means the attacker links small steps together, like a row of dominoes: each one only matters because it knocks over the next.
Step 1: trigger an abnormal request termination
The attacker causes a request to end abnormally. This is the precondition for everything that follows: it is what leaves the worker's internal state invalid. Nothing else in the chain can happen until the worker has been left in this messy state.
Step 2: exploit the stale memory state
A subsequent request reaches the invalid state left behind by the terminated one. Depending on which of the two bugs is in play, this is either memory mishandled after an out-of-memory condition or a reference to freed memory that is still reachable. A later request can then reach the invalid state left behind by the terminated one.
Step 3: overcome memory-layout protections
Modern systems shuffle memory around on purpose so that an attacker cannot predict where things are. The chain includes obtaining information that helps defeat those protections. The article does not detail the specific disclosure primitive or the exact bytes involved. In everyday terms: the attacker first works out the layout of the building before trying to walk through it in the dark.
Step 4: turn corruption into code execution
The resulting memory corruption is used to achieve code execution under the privileges of the PHP worker. Memory corruption means the attacker has managed to make the program write where it should not, and the payoff is that the worker runs the attacker's instructions instead of its own.
One property of the chain is called out specifically: some attack paths can operate before application-level logic executes. That is why the request-startup path on Apache with mod_php was identified as especially exposed in the demonstrated attack. Application-level logic is the part of the website written by the site owner, the checks and rules that normally run when a page is requested. If the attack happens before any of that runs, the website's own protections never get a chance to say no.
Timeline
The article lays out the disclosure and exploitation sequence as follows:
- August 2026: researchers developed and reported exploitable attack paths involving PHP memory-management weaknesses.
- 17 October 2026: Amazon's MadPot honeypots recorded the first known exploitation attempt reported in the article.
- 20 October 2026: the CVE identifiers leaked publicly, prompting emergency advisories.
- 21 October 2026: PHP released patched versions, and public proof-of-concept activity emerged.
- 22 to 23 October 2026: reported scanning and exploitation attempts escalated, with researchers describing improved exploitation techniques.
A honeypot is a decoy system set up to look interesting so that attackers try it, and defenders get to watch. A proof of concept is a working demonstration that the attack really works; once it is public, anyone can copy it. The ordering is the lesson: exploitation attempts were recorded before public disclosure, and the pace increased once proof-of-concept code was public.
Impact
Because the bugs sit in the engine, the impact is bounded by the worker's privileges and by the deployment's configuration, server architecture, permissions and which exploitation path succeeds. Privileges are what the worker is allowed to do; a worker with broad permissions gives an attacker more to work with. The article lists what the vulnerabilities can potentially enable:
- executing commands with the web worker's privileges;
- accessing application configuration and secrets;
- exposing credentials, session tokens or API keys;
- establishing persistence or moving toward other internal systems.
A secret here is any password, key or token the application uses. A session token is the short string a website gives your browser after you log in, so it can recognise you on the next click; if it leaks, someone else can pretend to be you. An API key is a similar string used by software talking to other software. Persistence means the attacker arranges to keep access after a reboot, so cleaning up once is not enough.
The article is careful to say that the precise impact depends on those factors, and that some observed activity was associated with botnet operations while other activity appeared more targeted. A botnet is a large collection of compromised machines driven together, usually for broad, automated attacks, as opposed to a single attacker picking one victim.
Threat activity and detection
Exploitation attempts began before public disclosure and expanded rapidly once proof-of-concept code became available. Observed activity included vulnerability scanning, attempts to deploy web shells, credential theft and malware delivery. Scanning is automated probing of many systems to see which ones answer in a useful way. A web shell is a small file an attacker plants on a server so they can run commands through the website later, like leaving a spare key behind.
Even where successful compromise is not confirmed, repeated probing of vulnerable systems warrants investigation. The article points to the following things to review on internet-facing PHP services:
- suspicious multipart requests;
- unexpected worker crashes;
- unusual PHP session cookies;
- unauthorised child processes;
- unexpected outbound connections.
A multipart request is the format a browser uses when it uploads a file or sends a form with several parts; it is normal traffic, which is exactly why odd versions of it are worth a look. A child process is a program started by another program; a shell or interpreter started by the web server is a strong warning sign. Outbound connections are the server reaching out to other machines; if it contacts an address the application has no business with, that is worth explaining.
Because the vulnerabilities can expose sensitive information, incident responders should also consider whether secrets need to be rotated. Rotating a secret means replacing it with a new one and retiring the old, so that a copy stolen earlier stops working.
Fix: patching and mitigation
Upgrading to a fixed release and restarting PHP workers are the primary remediation steps. Configuration changes and WAF rules add protection but should not replace patching. A WAF, or web application firewall, is a filter that inspects incoming requests and blocks ones that look malicious; it is useful, but it is a filter in front of the door, not a repair of the lock. The recommended actions are:
- Upgrade PHP: deploy a fixed release or a verified vendor-backported package.
- Restart all workers: restart PHP-FPM pools, Apache and other affected services so the patched code is actually loaded.
- Verify the web-facing runtime: check the version used by the application server, not just the CLI binary.
- Inventory all deployments: review virtual machines, containers, appliances and bundled PHP installations.
- Hunt for suspicious activity: review logs and endpoint telemetry for signs of exploitation, credential exposure or persistence.
- Rotate potentially exposed secrets: prioritise credentials accessible to vulnerable workers.
- Apply temporary controls: use appropriate WAF rules, restrict unnecessary exposure and isolate systems that cannot be patched promptly.
Step 2 deserves emphasis for newcomers: installing new files is not the same as running them. A running program keeps the old code in memory until it is restarted, so a server can look patched on disk and still be vulnerable in practice. PHP-FPM is a common way of running PHP workers separately from the web server. Telemetry is the recorded activity from machines, the logs and events you review afterwards.
Variants to test
The article does not publish request payloads, so the following are directions suggested by its own detection guidance rather than reproductions of the exploit.
- Inventory drift between CLI and web runtime. Compare the PHP version reported by the command-line binary with the version the application server actually loads. A positive result is a web-facing runtime older than the fixed releases in the table above, even where the CLI reports a patched version.
- Container and appliance images. Scan images before deployment and check running workloads separately. A positive result is an image or running container carrying an affected PHP version, or a running workload whose patched image was never actually restarted into.
- Worker crash telemetry. Look for unexpected PHP worker crashes correlated with unusual request patterns. A positive result is repeated crashes on the same pool followed by requests that behave differently.
- Multipart request anomalies. Review logs for suspicious multipart requests against PHP endpoints. A positive result is multipart traffic that does not match normal application behaviour and lines up in time with worker restarts or crashes.
- Session cookie anomalies. Look for unusual PHP session cookies. A positive result is session identifiers that do not correspond to any legitimate login flow.
- Process and network anomalies. Check for unauthorised child processes spawned by the web worker and for unexpected outbound connections. A positive result is a shell or interpreter process parented by the web server, or egress to an address the application has no reason to contact.
- Web shell and credential hunting. Given the observed attempts to deploy web shells and steal credentials, search the web root for newly written files and review accessible configuration and secret stores. A positive result is an unfamiliar executable file in a writable directory, or evidence that secrets reachable by the worker were read.
A container image is a packaged copy of an application and its runtime, used to start containers; scanning the image checks the package before it ever runs. Egress is outbound network traffic. The web root is the folder the website serves files from, so a new file there that nobody recognises is exactly the kind of thing to look for.
For the full timeline, vulnerability details, exploitation research and patching recommendations, the article points to Loginsoft's original post.
Glossary
- API key: a secret string that lets one piece of software prove its identity to another.
- Apache: a widely used web server program that answers requests from browsers.
- Application-level logic: the part of a website written by its owner, such as its checks and rules, which runs when a page is requested.
- Backport: a fix written for a newer version that a vendor adapts so it also works on an older one.
- Botnet: a large group of compromised machines controlled together, typically for broad automated attacks.
- Branch: a major version line of software, such as PHP 8.4, which receives its own small fix releases.
- Chain: a series of attack steps where each one only works because the previous one succeeded.
- Child process: a program started by another program; a shell started by the web server is a warning sign.
- Container: a packaged, isolated copy of an application and its runtime that can be started and stopped quickly.
- Container image: the packaged file from which containers are started; it can be scanned before use.
- CVE: a public catalogue number that identifies a specific known vulnerability.
- Egress: outbound network traffic leaving a system.
- End-of-life: a software branch that no longer receives fixes.
- Honeypot: a decoy system set up to attract attackers so defenders can observe them.
- Memory: the working space a program uses while it runs.
- Memory corruption: a bug where a program writes to memory it should not, letting an attacker influence what the program does.
- mod_php: a way of plugging PHP directly into the Apache web server.
- Multipart request: the format a browser uses to send a form with several parts or a file upload.
- Out-of-memory condition: when a program asks for more memory than it is allowed and the request dies.
- Outbound connection: a connection a server makes to another machine.
- Patch: a fixed version of software that removes the vulnerability.
- Persistence: an attacker's arrangement to keep access after reboots or clean-up.
- PHP: the programming language and engine that runs a large share of websites, including WordPress, Drupal and Joomla.
- PHP-FPM: a common way of running PHP workers separately from the web server.
- Privileges: what a program or user is allowed to do.
- Proof of concept: a working demonstration that an attack works, which others can copy.
- Remote code execution (RCE): making a remote server run commands of the attacker's choosing.
- Request: a message from a browser or tool asking a web server for something.
- Rotate: replace a secret with a new one and retire the old, so stolen copies stop working.
- Scanning: automated probing of many systems to find which ones respond usefully.
- Secret: any password, key or token an application uses.
- Session cookie: the short string a site gives your browser after login so it can recognise you afterwards.
- Session token: a string that stands in for a logged-in user; if it leaks, someone can impersonate them.
- Telemetry: recorded activity from machines, such as logs and events, used for investigation.
- Unauthenticated: reachable without logging in or having an account.
- Use-after-free: using memory that has already been released, while something still points at it.
- WAF (web application firewall): a filter that inspects incoming requests and blocks ones that look malicious.
- Web root: the folder a website serves its files from.
- Web shell: a small file planted on a server that lets an attacker run commands through the website later.
- Worker: the process on a server that handles requests one after another.