Workik.

PHP2Shell Response Guide: Patch, Mitigate and Harden PHP

PHP2Shell Explained: CVE-2026-109618 and CVE-2026-109619

Examine CVE-2026-109618 and CVE-2026-109619, check affected PHP versions and web SAPIs, review the disclosure timeline, and plan your response.

On 21 October 2026, the PHP project disclosed two critical PHP vulnerabilities, known together as PHP2Shell: CVE-2026-109618 and CVE-2026-109619. Both flaws allow unauthenticated remote code execution (RCE), which means an attacker can run arbitrary commands on your server over the network without logging in. Because this PHP RCE sits inside the PHP engine itself rather than a specific framework or plugin, even a single-line "Hello World" script is vulnerable if your PHP runtime is unpatched.

Next lesson: Find Every PHP Version and SAPI You Run


What Are CVE-2026-109618 and CVE-2026-109619?

Both CVE-2026-109618 and CVE-2026-109619 carry a Common Vulnerability Scoring System (CVSS) v4.0 score of 9.2, rated Critical. Early rumors on social media before the official release mentioned a 10.0 score, but the official PHP security advisory rates both at 9.2.

Wiz states that PHP powers about 70% of websites. Because these flaws exist in the core C code that handles incoming HTTP requests, your application code cannot filter them out. Wiz demonstrated remote code execution against the latest official container images for WordPress, Drupal, and Joomla.

CVE-2026-109618: OOM Corruption

The PHP advisory titles CVE-2026-109618 "OOM Corruption", where OOM stands for out-of-memory. When a PHP process runs out of memory while internal request data is only partly set up, the engine triggers a cleanup step. Due to this flaw, the cleanup step treats that incomplete internal data as valid.

An attacker can trigger this remotely by sending large or specially crafted multipart requests, such as file uploads or form posts.

CVE-2026-109619: Use-After-Free in Request State

CVE-2026-109619 is a use-after-free vulnerability. In memory-unsafe languages like C, a use-after-free flaw happens when a program frees a block of memory but keeps a pointer to it, and a later operation uses that pointer as if the data were still valid.

In PHP, state left over from one failed request can point to memory that has already been freed. When a second request is handled by the exact same worker process, PHP can use that dangling pointer. According to the PHP advisory, this flaw involves fatal errors or request timeouts, the session upload progress feature, and on PHP 8.5, the fatal error backtrace feature. Along with remote code execution, PHP lists memory disclosure as a confirmed impact.

Think of a PHP worker process like a hotel room between guests. If housekeeping misses something the last guest left behind, the next guest in that same room finds it.

Common Mistake: Do not assume your application is safe because you do not use file upload forms or WordPress. PHP parses multipart request data and session upload progress before your application router or controller even sees the request.

Every web-accessible PHP installation on an unpatched version is exposed, regardless of the framework or application code running on top of it.


Affected and Fixed PHP Versions

Researchers traced the earliest affected code all the way back to PHP 5.4.0. Your patch path depends on which PHP branch you run and whether you install PHP from upstream sources, container images, or Linux distribution packages.

PHP BranchStatusOfficial Fix VersionWhat You Should Do
PHP 8.5Active support8.5.12Upgrade to 8.5.13 or later, or apply your OS vendor patch
PHP 8.4Active support8.4.27Upgrade to 8.4.28 or later, or apply your OS vendor patch
PHP 8.3Security support8.3.36Upgrade to 8.3.37 or later, or apply your OS vendor patch
PHP 8.2Security support8.2.35Upgrade to 8.2.36 or later, or apply your OS vendor patch
PHP 7.4, 8.0, 8.1End-of-life upstreamNo official releaseUse Linux distro or LTS vendor patches, apply minimal source backports, or upgrade PHP
PHP 5.4 to 7.3End-of-life upstreamNoneIsolate from the network and upgrade to a supported branch

Linux distributions and long-term support (LTS) vendors received the patches in advance of public disclosure. If you run PHP from Ubuntu, Debian, or Red Hat Enterprise Linux (RHEL) repositories, your vendor package may carry the fix under an older version number like 8.1 or 8.2. You will verify those backported package versions in the next lesson.

If you build PHP 7.4, 8.0, or 8.1 from source, the PHP security team published minimal source backport patches, though they did not cut new official release tarballs for those branches.

Your remediation strategy depends entirely on whether your PHP branch is actively supported, covered by an OS vendor backport, or completely end-of-life.


Affected SAPIs and Why mod_php Is Highest Risk

A Server Application Programming Interface (SAPI) is the layer that connects the PHP engine to a web server or command prompt. According to the PHP advisory, every SAPI that serves web requests is at risk:

  • Apache mod_php
  • PHP-FPM (FastCGI Process Manager)
  • php-cgi
  • FrankenPHP
  • LiteSpeed

Command-line interface (CLI) scripts that do not serve web requests are not the main exposure. You should still update them at the same time because they share packages and libraries with your web runtime.

Why mod_php Carries the Highest Risk

The PHP advisory states that Apache mod_php is the highest risk configuration. With mod_php, the PHP interpreter is embedded directly inside each Apache worker process, and a demonstrated exploit can run before any application code executes.

PHP-FPM is also vulnerable and must be patched immediately. For CVE-2026-109619, one confirmed exploitation path requires two requests to land on the same worker process so the second request can hit the corrupted state left by the first.

Pro Tip: If you have dozens of servers to patch today, prioritize internet-facing Apache mod_php hosts first, followed immediately by internet-facing PHP-FPM, FrankenPHP, LiteSpeed, and php-cgi servers.

While mod_php presents the easiest target for attackers, every web-facing PHP SAPI requires patching.


Disclosure Timeline and Current Exploitation Status

Understanding the timeline tells you how far back your security team needs to inspect server logs.

  • 19 August 2026: Security researchers at Wiz discovered the issue.
  • 24 August 2026: Wiz reported the flaws to the PHP security team. The PHP Foundation credited Calif, OpenAI, and Wiz, among others, for finding and reporting the vulnerabilities. Calif and Wiz noted that they used artificial intelligence (AI) models in their research.
  • 17 October 2026: Amazon Threat Intelligence observed a first exploitation attempt against its honeypot, four days before the scheduled public disclosure.
  • 20 October 2026: The CVE identifiers leaked on Hacker News and social media. In response, the PHP project announced an upcoming security release.
  • 21 October 2026, 14:00 UTC: PHP released the fixes and advisories one day earlier than planned due to the leak. Cloudflare deployed web application firewall (WAF) rules the same day and described them as a stopgap.
  • 26 October 2026: The Cybersecurity and Infrastructure Security Agency (CISA) added both CVEs to its Known Exploited Vulnerabilities (KEV) catalog.
  • 19 November 2026: PHP shipped 8.2.36, 8.3.37, 8.4.28, and 8.5.13, which fix further critical flaws in session and request handling, including CVE-2026-115560, another session flaw.

Exploitation in the Wild

Multiple threat actors began exploiting PHP2Shell from 21 October 2026, and attacks have since been confirmed against real systems, including internet-facing security gateways that bundle their own PHP. Attackers used those gateways as a foothold into the networks behind them. Amazon described PHP2Shell as broadly exploited and recommended that organizations investigate their logs from 17 October 2026 onward. National cyber agencies, including CISA in the United States and the National Cyber Security Centre (NCSC) in the United Kingdom, told organizations to patch immediately.

Several public proof-of-concept (PoC) scripts have appeared online. Rapid7 analyzed these scripts and found that each works only for a specific combination of operating system, PHP version, and web server, and none is broadly reliable. Furthermore, the PHP Foundation's review found no functional exploits among the ones that leaked at release.

Common Mistake: Never download or run public exploit code from the internet to "test" whether your production servers are vulnerable. Unverified exploit scripts frequently fail to match your exact binary layout, can crash your worker processes, and often contain disguised malware or backdoors that compromise your workstation.

Treat any internet-facing PHP server that was unpatched on or after 17 October 2026 as potentially targeted, and verify your defenses through package versions and logs rather than live exploit scripts.


Your Response Plan: The Brightline Logistics Scenario

Throughout this course, you will apply each step to a realistic environment at a fictional company called Brightline Logistics. Brightline runs three PHP applications across different infrastructure stacks:

  • brightline-www: The public WordPress marketing site at www.brightline.example. It runs on Ubuntu 22.04 with Apache and mod_php, using Ubuntu's distribution packages for PHP 8.1.
  • brightline-portal: The customer portal, a Laravel application on PHP 8.3 with PHP-FPM and nginx, running in Docker from the official php:8.3-fpm base image.
  • brightline-invoicing: An old internal invoicing application running on PHP 7.4 on a Red Hat Enterprise Linux 8 virtual machine.

Notice how each application has a different risk profile:

  1. brightline-www is internet-facing and runs mod_php. It is the highest priority. Because it runs on Ubuntu 22.04 with PHP 8.1, you will check for Canonical's backported security update rather than an upstream PHP 8.1 release.
  2. brightline-portal is also internet-facing and runs PHP-FPM in Docker. You will need to pull the patched php:8.3.37-fpm image, rebuild, and redeploy the containers.
  3. brightline-invoicing runs end-of-life PHP 7.4 on an internal network. You will isolate it, check for vendor patches, and plan an upgrade to a supported branch like PHP 8.4.

Here is the response order you will follow across the rest of this course:

  1. Inventory: Find every PHP binary, web SAPI, and container image, and verify whether vendor backports are already installed (Lesson 2).
  2. Patch: Apply the October 2026 update and restart every worker process so old code does not stay in memory (Lesson 3).
  3. Mitigate: Apply temporary configuration settings and request size limits on systems you cannot patch immediately (Lesson 4).
  4. Hunt: Check web access logs, PHP error logs, and FPM logs from 17 October 2026 onward for signs of exploitation (Lesson 5).
  5. Upgrade and Harden: Replace end-of-life PHP versions, lock down PHP-FPM pools, and set up an ongoing patch process (Lessons 6, 7, and 8).

A structured response plan ensures you fix your highest-risk internet-facing servers first without overlooking legacy internal systems.


Try It Yourself

Before running a single command on your servers, sort your own applications by risk just like you did for Brightline Logistics.

Quick Challenge: Open a scratchpad and list the top three PHP applications you are responsible for. For each one, write down:

  1. Is it exposed to the public internet or internal only?
  2. Which SAPI does it use (mod_php, PHP-FPM, FrankenPHP, LiteSpeed, or php-cgi)?
  3. How is PHP installed (OS package manager, Docker image, managed hosting, or compiled from source)?
  4. Rank them from 1 to 3 in the order you should patch them, placing internet-facing mod_php servers at the very top.

If you do not know the exact version or SAPI for one of your servers, mark it as unknown. You will uncover that exact data in the next lesson.


In the next lesson, Find Every PHP Version and SAPI You Run, you will audit your servers and containers to uncover every running PHP version, web SAPI, and distro backport status.

Was this lesson helpful?