Cybersecurity

PHP2Shell: Two Critical PHP Core Flaws Allow Unauthenticated RCE (CVE-2026-109618, CVE-2026-109619)

Team Nippysoft
• • 12 min read
PHP2Shell: Two Critical PHP Core Flaws Allow Unauthenticated RCE (CVE-2026-109618, CVE-2026-109619)

On October 21, 2026, the PHP project shipped 8.5.12, 8.4.27, 8.3.36 and 8.2.35 with an unusually blunt advisory: the releases fix two critical vulnerabilities that can allow unauthenticated remote code execution (RCE), and every PHP user is strongly encouraged to update immediately. The bugs are CVE-2026-109618 and CVE-2026-109619, known together as PHP2Shell. Neither one depends on a sloppy plugin or an unsafe function call in your application. Both live in the interpreter core, in how PHP aborts a request when it runs out of memory and in the state it carries from one request to the next.

That changes the usual PHP security conversation. Auditing your own code does not help much here, because php.net rates the risk highest for Apache mod_php, where a demonstrated exploit lets an unauthenticated request trigger the attack before any application code runs. Third parties such as watchTowr and Unit 42 are already reporting activity. What follows is the mechanism behind each flaw, without exploitation detail, and what to do about it today.

What php.net announced and who is exposed

The advisory covers two separate CVEs fixed in the same releases by the same commit. The PHP project itself registered both as the CNA (the organization that assigns the CVE ID), and NVD (the National Vulnerability Database run by NIST) already lists them as "Analyzed". Each has its own GHSA (GitHub Security Advisory):

  • CVE-2026-109618, "RCE via OOM corruption" (GHSA-w8hw-w9fx-j79w): corruption when a request is aborted on an out-of-memory (OOM) condition.
  • CVE-2026-109619, "RCE via stale global state" (GHSA-6wmf-4rv5-p3rp): global state that keeps pointing into freed memory from an earlier request.

On scope, php.net leaves no room for interpretation: "all PHP installations serving web requests", which covers PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed, with the highest risk on mod_php. On FPM, the two CVEs differ. In the CVE-2026-109618 announcement on oss-security, Jakub Zelenka of the PHP security team explains that unauthenticated RCE has been demonstrated against mod_php and that code analysis indicates FPM is susceptible too, although no complete FPM exploit has been demonstrated. For CVE-2026-109619, by contrast, the GHSA says session lifecycle RCE was validated against both mod_php and FPM; on FPM it also needs the application to perform a specific operation.

The SAPI (the interface PHP uses to plug into the web server) changes how fast you need to move, not whether you are affected.

A typical case: an agency runs forty WordPress and Drupal sites on two Apache boxes with mod_php, plus a Laravel API in containers on PHP-FPM behind nginx. The mod_php fleet gets patched first, because that is where php.net places the highest risk; the API follows the same day.

CVE-2026-109618: a bailout that leaves memory half-built

When PHP runs out of memory mid-request, it does not hand an error back to whatever asked for the allocation. It calls longjmp() to escape the current context and abort request handling, a pattern PHP internals call a bailout. The jump happens exactly where the allocation failed, and whatever code was still due to run in that context never runs.

The official CVE description spells out the consequence. Some contexts do not account for this and leave request memory uninitialized before performing an allocation. The request cleanup procedure that runs after the jump may then read or branch on that memory. Per the advisory, multiple OOM strategies can trigger this condition consistently and lead to RCE.

The GHSA adds a detail that matters for defenders: several conditions in multipart parsing, the format used by forms with file uploads, can push memory to the limit. Body parsing happens before your code is invoked, so no check inside the application can intervene.

Why this happens: this is an old C failure mode. A non-local jump behaves like an exception without destructors, so any invariant the code meant to restore "at the end of the function" stays broken. Cleanup assumes structures are complete, and the attacker picks the moment when they are not.

CVE-2026-109619: global state that outlives the request

A PHP-FPM worker or an Apache process running mod_php does not exit after serving a request. It serves another one, and another. For that to be safe, every piece of global state that temporarily points into request memory (errors, session, objects, extensions) has to be reset in between.

CVE-2026-109619 is what happens when that reset fails. According to the official description, in some scenarios global state is not correctly reset, or is repopulated after being reset, and keeps referring to memory that has already been freed. A subsequent request may read or branch on that stale state before it is fully initialized. The result is a use-after-free that crosses the boundary between requests.

The GHSA names both halves of the problem. What leaves the state dirty: fatal errors such as parse failures, uncaught errors and execution timeouts, plus out-of-memory conditions. What reads it later: INI diagnostics during early startup and session upload progress tracking. Your own code can trigger the first half without knowing it: one fatal error or timeout is enough.

In a shared pool: several applications for the same customer run on one FPM pool. A request that times out in application A leaves state dangling, and the next request that worker picks up, possibly for application B, reads it during startup. Splitting sites across virtual hosts does not isolate the memory of a process that serves both.

PHP2Shell: HTTP multipart → OOM / longjmp() → stale global → use-after-free → RCE 1) HTTP multipart request. 2) Out-of-memory (OOM) bailout via longjmp(). 3) Stale global state points to freed request memory. 4) Use-after-free. 5) Remote code execution. Conceptual diagram, no payload. 1 HTTP multipart 2 memory_limit longjmp() OOM · bailout 3 global free() stale global 4 next request use-after-free 5 > RCE

CVSS 9.2, 9.8 or 8.1: which number to trust

A score without its CVSS version and the party that assigned it says little, and PHP2Shell shows why:

CVECVSS v4.0 (CNA, PHP)CVSS v3.1 (NVD)v3.1 attack complexity
CVE-2026-1096189.2 Critical9.8AC:L (low)
CVE-2026-1096199.2 Critical8.1AC:H (high)

The CNA uses the same v4.0 vector for both: AV:N/AC:H/AT:P/PR:N/UI:N, with high impact on confidentiality, integrity and availability. In plain terms, network reachable, no privileges, no user interaction, but high complexity and attack requirements present. NVD's v3.1 analysis rated 109618 as low complexity and 109619 as high complexity, hence 9.8 versus 8.1.

Where teams get it wrong: filtering scanner output on "CVSS v3.1 of 9 or higher" and pushing 109619 into the next cycle. Operationally that makes no sense, because one upgrade fixes both CVEs. The score can order your queue; it should not split the patch into two decisions.

How PHP fixed it

The fix is commit 3584a98 in php-src, authored by Arnaud Le Blanc with Ilija Tovilo, Jakub Zelenka, Nora Dossche and Nicolas Grekas as co-authors. The message is short. Under the subject "Avoid state corruption via bailout", it lists two changes: replacing the OOM bailout with UnwindExit and properly resetting various globals that may be accessed during startup. It landed on October 21.

According to GHSA-w8hw, out-of-memory handling no longer uses longjmp(). It now works in two tiers:

  • Soft OOM: the error is deferred to the next safe point in the VM (PHP's virtual machine), where state is consistent.
  • Hard OOM: if consumption reaches a higher threshold, the process ends with _exit() instead of attempting cleanup.

What it costs in production: two things follow from the design, by inference rather than from the advisory. First, because the error waits for a safe point, a request can briefly run past memory_limit before it stops, so per-worker memory sizing needs some headroom above that limit. Second, every hard OOM kills the process and the process manager has to start a replacement. Under normal traffic that is noise; under a sustained attack that forces OOM conditions, it shows up as worker churn and latency. It is still the right trade: a dead process is predictable, a process with corrupted state is not.

The commit adds 10,759 lines and removes 988, with a large set of new tests under Zend/tests/oom_*. If you maintain a patched PHP fork, plan for a substantial backport.

Which versions to deploy

BranchAffectedFixed in
8.5before 8.5.128.5.12
8.4before 8.4.278.4.27
8.3before 8.3.368.3.36
8.2before 8.2.358.2.35
8.6 (prerelease)builds before RC48.6.0 RC4
7.4, 8.0 and 8.1affected, no official binariesminimal source backports only

PHP 8.1 and older no longer receive updates, but the security team published minimal source backports for 7.4, 8.0 and 8.1 on dedicated branches in the php-src repository. NVD's affected range starts at 7.3.0 for CVE-2026-109618 and at 5.4.0 for CVE-2026-109619, even though the CNA only declares the 8.2 through 8.5 branches.

  1. Inventory every installation: php -v on each server and container image, or the distribution package version.
  2. Check your distribution vendor before concluding you are exposed. php.net notes that Linux distributions and LTS vendors received the patches in advance, so their package may carry the fix under a different version number.
  3. Upgrade mod_php hosts first, then FPM, php-cgi, FrankenPHP and LiteSpeed.
  4. Restart every PHP process and rebuild container images, including the ones that only run internal jobs.
  5. Plan your exit from 8.2, which reaches end of life on December 31, 2026, and treat migrating off 7.4, 8.0 and 8.1 as a project with a deadline.

Mitigations when you cannot upgrade today

php.net is explicit about the limits here: "while only an update is a complete solution, the following measures reduce exposure to specific attack paths but do not make an installation safe".

For CVE-2026-109618

  • memory_limit=-1, set so the application cannot override it, for example via php_admin_value.
  • A low post_max_size: 8M without file uploads, 32M with them, and upload_max_filesize below post_max_size.
  • Proxy limits on request size, number of fields and multipart parts, headers and nesting depth.
  • A cgroup or container memory limit.

For CVE-2026-109619

  • session.upload_progress.enabled=0, followed by a restart of every worker.
  • On PHP 8.5, fatal_error_backtraces=0.
  • Remove invalid or deprecated INI settings applied per request.
  • Fix the fatal errors and timeouts an attacker can trigger from outside.

An example PHP-FPM pool applying these settings without going through .user.ini:

; /etc/php/8.x/fpm/pool.d/www.conf (path varies by distribution)
php_admin_value[memory_limit] = -1
php_admin_value[post_max_size] = 8M
php_admin_value[upload_max_filesize] = 6M
php_admin_flag[session.upload_progress.enabled] = off
; PHP 8.5 only
php_admin_flag[fatal_error_backtraces] = off

Common mitigation mistakes

  • Toggling session settings with ini_set() or .user.ini. php.net says it directly: "Do not rely on ini_set() or FPM .user.ini".
  • Capping memory with RLIMIT_AS or RLIMIT_DATA. Per php.net, those limits can cause the very allocation failure that is vulnerable.
  • Hiding errors. "Hiding diagnostics with error_reporting, display_errors or @ does not help." The state is left dirty whether or not anyone sees the message.

Behind a load balancer: a load balancer fronts an nginx reverse proxy, which talks to containerized PHP-FPM pools. While the fixed image moves through the pipeline, the proxy is the only layer where you can bound what reaches PHP's parser, and the container memory limit provides the ceiling that memory_limit=-1 removes. Both layers buy hours; neither replaces the upgrade.

Detecting attempts and compromise

Huntress states it plainly: "No indicators of compromise have been confirmed yet." What is available are useful behavioral patterns:

  • Unusual multipart requests followed by memory-limit errors. Wiz advises defenders to watch for that sequence, along with repeated HTTP 500 responses, unexpectedly large or malformed PHPSESSID cookies and unexplained PHP worker churn.
  • Suspicious child processes spawned by PHP. Huntress suggests alerting on processes whose parent is php-fpm, php-cgi, php-cgi.exe, httpd or apache2.
  • Command lines containing reverse shell markers such as /dev/tcp/, fsockopen or mkfifo.
  • Reconnaissance commands launched from those processes: whoami, id, uname -a or ipconfig.

Reported exploitation and timeline

Every claim below is attributed to whoever made it. On discovery, the CVE records (CVE-2026-109618 and CVE-2026-109619) credit Wiz, Ryan (Calif.io) and OpenAI.

  • watchTowr says it has observed in-the-wild exploitation since October 21, 2026, through its honeypot network.
  • Unit 42 (Palo Alto Networks) says it has seen proof-of-concept code, and its Cortex Xpanse telemetry identifies over 22.6 million exposed instances that are potentially vulnerable. That figure is the vendor's own data, not an independent measurement.
  • Huntress, as of 4:30 PM ET on October 21, had not observed in-the-wild exploitation on partner systems.
  • CISA KEV: neither CVE appears in the Known Exploited Vulnerabilities catalog as of its October 23, 2026 release.
DateEvent
2026-10-20Details leak on social media ahead of coordinated disclosure, per Huntress and watchTowr. php.net pre-announces a critical patch for October 21 at 14:00 UTC.
2026-10-21CVEs, GHSAs, fixed releases, PHP 8.6.0 RC4 and the oss-security post are published.

Side note: on October 23, php.net published an informational notice about a different RCE path, CVE-2026-115560, with no NVD record yet, to be fixed in the regular release cycle. It is not part of PHP2Shell, but it changes one recommendation: php.net suggests keeping session.upload_progress.enabled=0 until the next release, even if you have already upgraded.

Frequently asked questions

Am I affected if I run PHP-FPM rather than mod_php?

Yes. php.net lists PHP-FPM among the installations at risk. The exploit that needs nothing from the application is demonstrated against mod_php, and for CVE-2026-109619 PHP validated an RCE against FPM that also needs the application to perform a specific operation.

Is disabling session.upload_progress.enabled enough?

No. It narrows one CVE-2026-109619 path, but it does not make an installation safe: you still need to upgrade. Afterwards, keep it disabled until the next release, as php.net recommends because of CVE-2026-115560.

Is PHP2Shell in the CISA KEV catalog?

Not as of October 23, 2026. Even so, watchTowr reports exploitation since October 21 and Unit 42 says it has seen proof-of-concept code, so absence from KEV is no reason to wait.

Conclusion

PHP2Shell is a pair of state management errors in the PHP core, out of reach of any input check in the application, with a demonstrated mod_php exploit that fires before your code runs, a validated RCE against FPM and exploitation reported by third parties. The response is boring and well understood: inventory, upgrade to 8.5.12, 8.4.27, 8.3.36 or 8.2.35, restart every PHP process and rebuild your images.

If you run a PHP fleet, start today with your mod_php hosts and the container images nobody has rebuilt in months. And if you want vulnerabilities like this one covered at the depth an engineering team needs, keep following the Nippysoft blog.

Read next: how to verify the patch on Ubuntu, Debian, RHEL, Docker and cPanel, and why a compromise investigation should start on October 17.

References

Subscribe

Get the latest posts delivered right to your inbox.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Comments

No comments yet. Be the first to share your thoughts!

Subscribed!

Registered! A confirmation link has been sent to your email address. If you don't see it, please check your spam folder.

Error

An error occurred. Please try again.

Full code