Skip to content
RCE Write-up Advanced

PHP2Shell: Two Critical PHP Flaws (CVE-2026-109618 and CVE-2026-109619)

Two memory-safety flaws in PHP can allow unauthenticated remote code execution with the privileges of the PHP worker. One involves reading invalid memory when a request fails midway, and the other is a use-after-free across reused workers.

Aravind S Follow

Published on medium.com

Cybersecurity

Aravind S, on medium.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

PHP2Shell is the collective name for two critical vulnerabilities in the PHP runtime itself: CVE-2026-109618 and CVE-2026-109619. The PHP project released emergency security updates for both on 21 October 2026. Neither bug lives in a CMS, framework or plugin, which is what makes the exposure so wide: WordPress and Drupal sites, custom applications, containers, managed platforms and any product that bundles PHP all fall within scope.

Both flaws are memory-safety problems in how PHP handles a request that fails partway through, particularly when it runs out of memory (OOM). Both can allow unauthenticated remote code execution with the privileges of the PHP worker.

PHP2Shell: CVE-2026–109618 and CVE-2026–109619 From the original on medium.com

The overview image introduces the two CVEs, their potential impact, affected versions and available fixes.

Setup

This is an analysis of public advisories and vendor reporting rather than a hands-on lab walkthrough, so there are no accounts, roles or tooling to set up. The relevant preconditions are on the target side:

  • A web-serving PHP installation on a pre-fix version. Treat any such install as exposed until you verify otherwise.
  • The highest-risk configuration is internet-facing Apache with mod_php. PHP-FPM, php-cgi and other integrations are also affected.
  • Wiz and Calif report that versions back to PHP 5.4 are affected.

Fixed releases are PHP 8.2.35, 8.3.36, 8.4.27 and 8.5.12. PHP published source-only backports for 7.4, 8.0 and 8.1; these are not regular releases, and PHP 7.3 and older get no fix from PHP. PHP 8.2 itself reaches end of life on 31 December 2026.

Finding it

The report describes the discovery as a combination of independent research efforts:

  1. 11 August: Calif and OpenAI independently report the out-of-memory RCE flaw to PHP, per the PHP Foundation.
  2. 19 to 24 August: Per Wiz, it independently found related flaws, confirmed unauthenticated RCE against WordPress and Drupal, and reported to PHP on 24 August.
  3. 21 September: Per Wiz, PHP acknowledged the reports and began work on a fix.
  4. 17 October: Amazon's MadPot honeypots record an exploitation attempt from an anonymization-service IP.
  5. 20 October: The CVE IDs leak online ahead of the planned disclosure. PHP publishes an advance notice.
  6. 21 October, around 02:00 UTC: Amazon sees the earliest public proof-of-concept exploits, hours before the embargo lifts.
  7. 21 October, 14:00 UTC: PHP publishes the patched releases and advisories.
PHP2Shell: Timeline From the original on medium.com

The timeline image lays out these dates from the initial reports through to the patched releases.

Amazon saw proof-of-concept exploits before the patch shipped. PHP's security team says it had not identified functional exploits at release time, while watchTowr says it reproduced both flaws. The practical conclusion drawn is to assume working exploits exist.

Exploitation

Step 1: CVE-2026-109618, the half-built request

When memory runs out, PHP abruptly exits the current code path. If that happens before request data is fully set up, PHP's shutdown code later reads invalid memory.

With Apache mod_php, shutdown runs even when startup failed, and request-body parsing happens during startup. The vulnerable sequence therefore completes before your application code runs. PHP-FPM exits the worker on startup failure, which changes the path. The advisory says source analysis still supports FPM exposure, but no complete FPM exploit was demonstrated for this CVE.

PHP2Shell: CVE-2026–109619 From the original on medium.com

The CVE-2026-109619 image sits alongside the discussion of the half-built request.

Step 2: CVE-2026-109619, the stale pointer

PHP workers are reused across requests. If one request leaves a dangling pointer behind, the next request on the same worker can trip over it before PHP resets it. That is a use-after-free, and it can become code execution.

The advisory confirms two cases: PHP 8.5's fatal-error backtrace feature, and session upload-progress handling, which is on by default and does not require session_start(). It also warns that there is no complete generic config mitigation, because other request state may be reachable depending on your application and extensions.

Step 3: Exploitation in the wild

Amazon Threat Intelligence reports an attempt on 17 October, four days before disclosure, and says exploitation is now broad. watchTowr, on the other hand, said it had seen no successful attacks as of 21 October. The report treats the exploitation and exposure details as coming from vendor reporting, which is not equally verified.

Root cause

Both bugs are memory-safety failures in PHP's handling of a request that fails midway, especially under OOM:

  • CVE-2026-109618: shutdown code reads invalid memory when the request was never fully set up. In mod_php the shutdown path runs even after a failed startup, and body parsing happens during startup, so the bad sequence is reachable before application code executes.
  • CVE-2026-109619: a dangling pointer left by one request survives into the next request on the same reused worker and is dereferenced before PHP resets it. The confirmed cases are the PHP 8.5 fatal-error backtrace feature and session upload-progress handling.

The report warns that application-level defences and clean application logs are not proof of safety. The report notes there is no complete generic configuration mitigation for CVE-2026-109619, since other request state may be reachable depending on the application and extensions.

Impact

Both vulnerabilities are rated Critical, CVSS v4.0 9.2, per the PHP advisories.

Exposure is broad because the flaw is in the runtime rather than in any one application. The report advises looking beyond what you installed yourself:

  • Container images, Kubernetes workloads and CI runners
  • Managed PHP runtimes and serverless functions
  • Hosting control panels, vendor appliances and products that bundle PHP
  • Long-lived worker pools, where a package update does not replace running processes

Fix

The priority is to upgrade to a fixed release and confirm the patched runtime is the one actually running.

A ChatGPT generated image From the original on medium.com
  1. Inventory: Identify every PHP installation, starting with internet-facing systems.
  2. Upgrade: Move to 8.2.35, 8.3.36, 8.4.27 or 8.5.12.
  3. Restart and verify: Restart workers or redeploy containers, then confirm the running version.
  4. Interim controls: If patching is delayed, restrict multipart requests, disable session upload progress where appropriate, and apply WAF rules. These reduce exposure but are not a fix. The PHP advisories list the specific settings. Consider isolating exposed systems that cannot be patched.
  5. Check for compromise: Review activity from at least 17 October onward. Patching does not remove a backdoor that is already in place.

For branches without a regular release, PHP published source-only backports for 7.4, 8.0 and 8.1. PHP 7.3 and older get no fix from PHP; unless your distribution or vendor supports a patched build, plan to migrate.

The report also notes an AI angle: Wiz credits frontier AI models with a major role in finding the flaws and building exploits, saying one researcher did in about a week what might have taken a top team months. Amazon makes a related point that AI-assisted analysis shortens the path from patch diff to working exploit, which strains 7- or 30-day patch windows for critical internet-facing bugs. Both are presented as informed assessments rather than measured facts.

Variants to test

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 17 min read.

What happened, in plain words

On 21 October 2026, the people who maintain PHP released emergency security updates. PHP is the programming language that runs a very large share of the world's websites, including most WordPress and Drupal sites. The updates fix two serious bugs, which together are called PHP2Shell: CVE-2026-109618 and CVE-2026-109619.

A vulnerability is a mistake in software that someone else can abuse to make the software do something it was never meant to do. A CVE (Common Vulnerabilities and Exposures) is a public catalogue number given to a vulnerability so that everyone can talk about the same bug by the same name. Think of it like a case number at a police station: it does not tell you what happened, it just lets people refer to one specific case without confusion.

Both of these bugs can let an attacker run their own code on a server without logging in first. That is called remote code execution, or RCE. A simple comparison: imagine someone who can slip instructions into a factory's machinery from outside the building, without a badge, and the machines then follow those instructions. The attacker's code runs with the same permissions as the PHP process that serves the website, which is called the PHP worker (explained below).

PHP2Shell: CVE-2026–109618 and CVE-2026–109619 From the original on medium.com

The overview image introduces the two CVEs, their potential impact, affected versions and available fixes.

The important point is where the bugs live. They are not in a CMS (the content management system, such as WordPress, that you use to build a site), not in a framework (a toolkit programmers build on), and not in a plugin (an add-on). They are in PHP itself, the layer underneath all of those. That is why the exposure is so wide: WordPress and Drupal sites, custom applications, containers, managed platforms, and any product that bundles PHP are all in scope.

A container is a packaged, self-contained way of running software, a bit like a lunchbox that carries an application and everything it needs. A managed platform is a hosting service where someone else runs the servers for you. "Bundles PHP" means the product ships its own copy of PHP inside it, so you may be running PHP without ever having installed it yourself.

Setup

This is an analysis of public advisories and vendor reporting rather than a hands-on lab walkthrough, so there are no accounts, roles or tooling to set up. An advisory is the official notice a software project publishes to describe a security bug and its fix. Vendor reporting means write-ups from companies that sell security products or services, such as Amazon or Wiz.

The relevant preconditions are on the target side, meaning the things that must be true about the server being attacked:

  • A web-serving PHP installation on a pre-fix version. Treat any such install as exposed until you verify otherwise.
  • The highest-risk configuration is internet-facing Apache with mod_php. PHP-FPM, php-cgi and other integrations are also affected.
  • Wiz and Calif report that versions back to PHP 5.4 are affected.

Some of those terms need unpacking. Apache is a web server, the program that receives requests from browsers and hands them to the right place. mod_php is a way of plugging PHP directly into Apache so that the web server itself runs the PHP code. PHP-FPM is a different way of running PHP: a separate pool of processes that Apache or another web server passes requests to. php-cgi is an older, simpler way of running PHP as a separate program per request. Internet-facing means reachable from the open internet, as opposed to only from inside a company network.

Fixed releases are PHP 8.2.35, 8.3.36, 8.4.27 and 8.5.12. A release here means a published version of PHP you can download and install. PHP published source-only backports for 7.4, 8.0 and 8.1. A backport is a fix taken from newer code and applied to an older version; source-only means you get the code but not a ready-made package, so you have to compile it yourself. These are not regular releases, and PHP 7.3 and older get no fix from PHP. End of life means the project has stopped supporting that version, so no more security fixes arrive for it. PHP 8.2 itself reaches end of life on 31 December 2026.

Finding it

The report describes the discovery as a combination of independent research efforts. Independent here means different groups found related problems without coordinating with each other, which is a strong sign the bugs are real and not a one-off mistake.

  1. 11 August: Calif and OpenAI independently report the out-of-memory RCE flaw to PHP, per the PHP Foundation. Out-of-memory (OOM) means the program asked for more memory than it was allowed and had to stop what it was doing. The PHP Foundation is the organisation that supports the PHP project.
  2. 19 to 24 August: Per Wiz, it independently found related flaws, confirmed unauthenticated RCE against WordPress and Drupal, and reported to PHP on 24 August. Unauthenticated means the attacker does not need an account or password.
  3. 21 September: Per Wiz, PHP acknowledged the reports and began work on a fix.
  4. 17 October: Amazon's MadPot honeypots record an exploitation attempt from an anonymization-service IP. A honeypot is a decoy system set up to look interesting to attackers so that their activity can be watched. MadPot is the name Amazon gives its honeypot network. An anonymization service is something like a VPN that hides where traffic really comes from, so the source address is not the attacker's own.
  5. 20 October: The CVE IDs leak online ahead of the planned disclosure. Disclosure is the moment a bug becomes public. A leak means the details came out earlier than planned.
  6. 21 October, around 02:00 UTC: Amazon sees the earliest public proof-of-concept exploits, hours before the embargo lifts. A proof of concept (PoC) is a small demonstration that the bug can actually be triggered. An embargo is an agreed quiet period during which the details are kept private so that people have time to patch.
  7. 21 October, 14:00 UTC: PHP publishes the patched releases and advisories.
PHP2Shell: Timeline From the original on medium.com

The timeline image lays out these dates from the initial reports through to the patched releases.

Amazon saw proof-of-concept exploits before the patch shipped. PHP's security team says it had not identified functional exploits at release time, while watchTowr says it reproduced both flaws. watchTowr is a security company that studies vulnerabilities. Reproduced means they made the bug happen themselves, which is stronger evidence than reading the code and guessing. The practical conclusion drawn is to assume working exploits exist.

Exploitation

Exploitation means actually using a vulnerability to achieve something, rather than just knowing it exists.

Step 1: CVE-2026-109618, the half-built request

When memory runs out, PHP abruptly exits the current code path. If that happens before request data is fully set up, PHP's shutdown code later reads invalid memory.

A request is what your browser sends to a server when you open a page or submit a form. Memory is the working space a program uses while it runs. Invalid memory means reading from a place that no longer holds what the program thinks it holds, like reading a page of notes that has already been erased and reused for something else.

With Apache mod_php, shutdown runs even when startup failed, and request-body parsing happens during startup. Startup is the preparation phase before the application code runs. Shutdown is the clean-up phase afterwards. Parsing means reading raw incoming data and turning it into usable pieces; the request body is the part of the request that carries data, such as a submitted form. The vulnerable sequence therefore completes before your application code runs. PHP-FPM exits the worker on startup failure, which changes the path. The advisory says source analysis still supports FPM exposure, but no complete FPM exploit was demonstrated for this CVE. Source analysis means reading the code carefully rather than running an attack.

PHP2Shell: CVE-2026–109619 From the original on medium.com

The CVE-2026-109619 image sits alongside the discussion of the half-built request.

Step 2: CVE-2026-109619, the stale pointer

PHP workers are reused across requests. A worker is a process that stays alive and handles one request after another, like a cashier who serves a queue of customers rather than being replaced for each one. If one request leaves a dangling pointer behind, the next request on the same worker can trip over it before PHP resets it. A pointer is a note that says "the data you want is over there". A dangling pointer is that note pointing at a place that has since been cleared or reused. That is a use-after-free, and it can become code execution. The name describes it exactly: the program uses memory after it has been freed.

The advisory confirms two cases: PHP 8.5's fatal-error backtrace feature, and session upload-progress handling, which is on by default and does not require session_start(). A fatal error is an error serious enough to stop the program. A backtrace is a list of the steps the program took to get where it is, useful for debugging. A session is how a website remembers who you are between requests, usually via a cookie; a cookie is a small piece of data your browser stores and sends back. Upload progress is the feature that lets a site show a progress bar while a file uploads. session_start() is the PHP function that normally begins a session; the point here is that this particular code path runs even without it.

It also warns that there is no complete generic config mitigation, because other request state may be reachable depending on your application and extensions. A mitigation is something that reduces the risk without removing the cause. Config is short for configuration, the settings of the software. Extensions are add-on modules that give PHP extra abilities.

Step 3: Exploitation in the wild

"In the wild" means attacks happening against real systems, not in a test lab. Amazon Threat Intelligence reports an attempt on 17 October, four days before disclosure, and says exploitation is now broad. watchTowr, on the other hand, said it had seen no successful attacks as of 21 October. The report treats the exploitation and exposure details as coming from vendor reporting, which is not equally verified. Verified means independently confirmed.

Root cause

A root cause is the underlying reason a bug exists, as opposed to its symptoms. Both bugs are memory-safety failures in PHP's handling of a request that fails midway, especially under OOM. Memory safety is the property that a program only ever touches memory it is allowed to touch; when that property breaks, an attacker may be able to steer what the program does.

  • CVE-2026-109618: shutdown code reads invalid memory when the request was never fully set up. In mod_php the shutdown path runs even after a failed startup, and body parsing happens during startup, so the bad sequence is reachable before application code executes.
  • CVE-2026-109619: a dangling pointer left by one request survives into the next request on the same reused worker and is dereferenced before PHP resets it. To dereference a pointer is to follow the note and use whatever is at the other end. The confirmed cases are the PHP 8.5 fatal-error backtrace feature and session upload-progress handling.

The report warns that application-level defences and clean application logs are not proof of safety. The runtime is the engine that executes the code. Application-level controls are protections built into the website itself, such as login checks or input filtering. If the damage happens underneath them, they never get a chance to help. The report notes there is no complete generic configuration mitigation for CVE-2026-109619, since other request state may be reachable depending on the application and extensions.

Impact

Impact means what an attacker could actually achieve. Both vulnerabilities are rated Critical, CVSS v4.0 9.2, per the PHP advisories. CVSS is a standard scoring system for how severe a vulnerability is; v4.0 is the version of that scoring system, and 9.2 is the score, on a scale where higher is worse. Both can allow unauthenticated remote code execution with the privileges of the PHP worker. Privileges are the permissions a process has; running code with the worker's privileges means the attacker inherits whatever the worker is allowed to do.

Exposure is broad because the flaw is in the runtime rather than in any one application. The report advises looking beyond what you installed yourself:

  • Container images, Kubernetes workloads and CI runners. A container image is the template a container is built from. Kubernetes is software for running many containers across many machines. CI runners are machines that automatically build and test code.
  • Managed PHP runtimes and serverless functions. Serverless functions are small pieces of code that run on demand without you managing a server.
  • Hosting control panels, vendor appliances and products that bundle PHP. A control panel is the web interface a hosting company gives you to manage your site. An appliance is a preconfigured box you plug in and use.
  • Long-lived worker pools, where a package update does not replace running processes. A package update changes the files on disk; a process already running keeps the old code in memory until it is restarted.

Fix

The priority is to upgrade to a fixed release and confirm the patched runtime is the one actually running. Patched means the fix has been applied.

A ChatGPT generated image From the original on medium.com
  1. Inventory: Identify every PHP installation, starting with internet-facing systems. An inventory is simply a list of what you have.
  2. Upgrade: Move to 8.2.35, 8.3.36, 8.4.27 or 8.5.12.
  3. Restart and verify: Restart workers or redeploy containers, then confirm the running version. To redeploy is to replace the running copy with a freshly built one.
  4. Interim controls: If patching is delayed, restrict multipart requests, disable session upload progress where appropriate, and apply WAF rules. Interim means temporary, until the real fix is in place. Multipart requests are requests that carry file uploads or several pieces of data at once. A WAF (web application firewall) is a filter that inspects incoming traffic and blocks patterns that look malicious. These reduce exposure but are not a fix. The PHP advisories list the specific settings. Consider isolating exposed systems that cannot be patched.
  5. Check for compromise: Review activity from at least 17 October onward. Patching does not remove a backdoor that is already in place. A backdoor is a way in that an attacker has planted so they can return later, even after the original bug is fixed.

For branches without a regular release, PHP published source-only backports for 7.4, 8.0 and 8.1. A branch is a line of development for one version. PHP 7.3 and older get no fix from PHP; unless your distribution or vendor supports a patched build, plan to migrate. A distribution here means an operating system's package supplier, such as a Linux distribution. To migrate is to move to a newer version.

The report also notes an AI angle: Wiz credits frontier AI models with a major role in finding the flaws and building exploits, saying one researcher did in about a week what might have taken a top team months. Frontier AI models means the most capable models available at the time. Amazon makes a related point that AI-assisted analysis shortens the path from patch diff to working exploit, which strains 7- or 30-day patch windows for critical internet-facing bugs. A patch diff is the comparison showing exactly which lines changed in the fix, which can hint at how to attack the unfixed version. A patch window is the period between a fix being published and attackers using it. Both are presented as informed assessments rather than measured facts.

Variants to test

A variant is a slightly different setup that might be affected in the same way. Testing here means checking your own systems, not attacking anyone else's.

  • Memory corruption means memory has been changed in a way the program did not intend.

Glossary

  • Advisory: the official notice a software project publishes about a security bug and its fix.
  • Anonymization service: a service such as a VPN that hides where network traffic really comes from.
  • Apache: a widely used web server program.
  • Appliance: a preconfigured hardware or software box you plug in and use.
  • Application-level controls: protections built into a website itself, such as login checks or input filtering.
  • Backdoor: a way in that an attacker plants so they can return later.
  • Backport: a fix taken from newer code and applied to an older version.
  • Backtrace: a list of the steps a program took to reach its current point, used for debugging.
  • Branch: a line of development for one version of software.
  • Bundles PHP: ships its own copy of PHP inside the product.
  • CI runner: a machine that automatically builds and tests code.
  • CMS: content management system, software such as WordPress used to build and run a website.
  • Config: short for configuration, the settings of software.
  • Container: a packaged, self-contained way of running software with everything it needs.
  • Container image: the template a container is built from.
  • Control panel: a web interface for managing a hosted website.
  • Cookie: a small piece of data a browser stores and sends back to a site.
  • CVE: a public catalogue number given to a vulnerability so everyone can refer to the same bug.
  • CVSS: a standard scoring system for the severity of a vulnerability.
  • Dangling pointer: a pointer that refers to memory that has since been cleared or reused.
  • Dereference: to follow a pointer and use whatever is at the other end.
  • Disclosure: the moment a bug becomes public.
  • Distribution: an operating system's package supplier, such as a Linux distribution.
  • Embargo: an agreed quiet period during which vulnerability details are kept private so people can patch.
  • End of life: the point at which a project stops supporting a version, so no more security fixes arrive.
  • Exploitation: actually using a vulnerability to achieve something.
  • Extension: an add-on module that gives PHP extra abilities.
  • Fatal error: an error serious enough to stop the program.
  • Framework: a toolkit programmers build applications on.
  • Frontier AI models: the most capable AI models available at the time.
  • Honeypot: a decoy system set up to attract and observe attackers.
  • Impact: what an attacker could actually achieve.
  • Independent: found by different groups without coordinating with each other.
  • Internet-facing: reachable from the open internet.
  • Interim: temporary, until the real fix is in place.
  • Inventory: a list of what you have.
  • Invalid memory: memory that no longer holds what the program thinks it holds.
  • Kubernetes: software for running many containers across many machines.
  • Leak: information that came out earlier than planned.
  • Managed platform: a hosting service where someone else runs the servers for you.
  • Memory: the working space a program uses while it runs.
  • Memory corruption: memory changed in a way the program did not intend.
  • Memory safety: the property that a program only touches memory it is allowed to touch.
  • Migrate: move to a newer version.
  • Mitigation: something that reduces risk without removing the cause.
  • mod_php: a way of plugging PHP directly into the Apache web server.
  • Multipart request: a request that carries file uploads or several pieces of data at once.
  • Out-of-memory (OOM): the program asked for more memory than allowed and had to stop.
  • Package update: a change to the files on disk, which does not affect processes already running.
  • Parsing: reading raw incoming data and turning it into usable pieces.
  • Patch diff: the comparison showing exactly which lines changed in a fix.
  • Patch window: the period between a fix being published and attackers using it.
  • Patched: the fix has been applied.
  • PHP: the programming language that runs a large share of websites.
  • PHP-FPM: a way of running PHP as a separate pool of processes that a web server passes requests to.
  • php-cgi: an older way of running PHP as a separate program per request.
  • PHP Foundation: the organisation that supports the PHP project.
  • PHP worker: a process that stays alive and handles one request after another.
  • Plugin: an add-on for a CMS.
  • Pointer: a note saying where the data you want is stored.
  • Process: a running copy of a program.
  • Proof of concept (PoC): a small demonstration that a bug can actually be triggered.
  • Privileges: the permissions a process has.
  • Release: a published version of software you can download and install.
  • Remote code execution (RCE): running your own code on someone else's server without logging in.
  • Reproduced: made the bug happen yourself, rather than only reading about it.
  • Request: what a browser sends to a server when you open a page or submit a form.
  • Request body: the part of a request that carries data, such as a submitted form.
  • Root cause: the underlying reason a bug exists.
  • Runtime: the engine that executes code.
  • SAPI: the layer that connects PHP to whatever is running it.
  • Serverless function: a small piece of code that runs on demand without you managing a server.
  • Session: how a website remembers who you are between requests.
  • Shutdown: the clean-up phase after code runs.
  • Source analysis: reading code carefully rather than running an attack.
  • Source-only backport: a fix for an older version supplied as code only, which you must compile yourself.
  • Startup: the preparation phase before application code runs.
  • Unauthenticated: without needing an account or password.
  • Upload progress: the feature that lets a site show a progress bar during a file upload.
  • Use-after-free: using memory after it has been freed.
  • Vendor reporting: write-ups from companies that sell security products or services.
  • Verified: independently confirmed.
  • Vulnerability: a mistake in software that someone else can abuse.
  • WAF: web application firewall, a filter that inspects incoming traffic and blocks malicious patterns.
  • Worker: a process that stays alive and handles requests one after another.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.