Skip to content
Cyber Army LogoCyber Army®
Threat intel2026-10-21·12 min read

php2shell: two PHP bugs that put much of the web one request from RCE

On October 21, 2026, the PHP project shipped an emergency fix for two critical bugs, CVE-2026-109618 and CVE-2026-109619, chained together as php2shell. Together they give unauthenticated remote code execution against a default PHP install. Here is what happened, who found it, how the race after disclosure played out, and exactly what to do about it.

CA
Cyber Army Threat Research
Harshith Barri and Devansh Dubey· Sunnyvale, CA
php2shell: unauthenticated RCE in default PHP via session upload progress.
Patch now. php2shell gives unauthenticated remote code execution on a default PHP install. Fixed releases, shipped October 21, 2026: 8.5.12, 8.4.27, 8.3.36, and 8.2.35. PHP 8.1 and older are end of life and will not be fixed, so move to a supported branch. In-the-wild exploitation is not yet independently confirmed, but the preconditions are the shipped defaults and the PHP maintainers say there is no complete mitigation, so treat patching as urgent. If you cannot patch immediately, see mitigation. Not sure where you stand? Run our free php2shell scanner.

The short version

php2shell is the nickname for a pair of memory-safety bugs in PHP's core engine. In both, PHP gets interrupted while a request is only half-built and then treats that half-built state as valid. One bug, CVE-2026-109618, is triggered by forcing an out-of-memory error at a chosen moment; the other, CVE-2026-109619, reuses request-owned state after it has been freed and relies on the on-by-default upload-progress feature. Chained with a way to defeat ASLR, they produce unauthenticated remote code execution on a default PHP configuration.

Wiz Research estimates roughly 70 percent of internet-facing PHP applications are affected, putting php2shell in the same conversation as Log4Shell and Heartbleed for blast radius. The feature responsible has been on by default since PHP 5.4 in 2012.

What php2shell is

CVESeverityImpact
CVE-2026-1096189.2 Critical (v4)Out-of-memory corruption: an OOM abort leaves request data half-initialized and cleanup treats it as valid, enabling RCE when combined with an ASLR bypass
CVE-2026-1096199.2 Critical (v4)Stale global-state use-after-free: request-owned state is reused after it is freed; requires session.upload_progress (on by default)

Neither bug requires a login, a token, or any special application feature. They target PHP itself, not a framework or a plugin, so WordPress, Laravel, Drupal, Magento, and bespoke PHP all sit on the same vulnerable foundation. The only precondition is that session.upload_progress.enabled is on, which is the shipped default.

What this means for WordPress and other CMS sites

WordPress, WooCommerce, Drupal, Joomla, and Magento all run on PHP, and WordPress alone powers roughly 40 percent of the web. If your site runs on PHP, it sits on the same vulnerable foundation, no matter how well maintained your themes and plugins are.

The important nuance: php2shell is a bug in PHP itself, not in WordPress or any plugin. A WordPress core or plugin update will not fix it. The fix is at the PHP layer:

  • Upgrade PHP to a patched release: 8.5.12, 8.4.27, 8.3.36, or 8.2.35 (PHP 8.1 and older are end of life).
  • If you cannot upgrade right away, disable session.upload_progress.
  • On managed WordPress hosting, your host controls the PHP version, so ask them when they are patching PHP.

Who found it

Credit matters here, and there was early confusion, so to be clear: per OpenAI's own disclosure, Calif Research identified the flaw using OpenAI's GPT-5.6 Sol model as part of OpenAI's "Patch the Planet" initiative, and reported it privately to PHP in August 2026 (the Calif researcher credited first is @lcfr_hax, Ryan Austin). Wiz Research independently discovered and reported both bugs, using GPT-5.6 Sol, Gemini 4 Argon, and its own Wiz Atlas tooling, and demonstrated unauthenticated RCE against WordPress, Drupal, and Joomla. The PHP Foundation led the fixes and shipped the emergency release on October 21. php2shell is notable for how it was found as much as for what it is: it is one of the first internet-scale bugs where AI did the finding, and OpenAI calls it one of the most impactful security issues in recent memory.

Calif Research (@calif_io) crediting @lcfr_hax as the first to discover php2shell and build a working exploit.
Calif Research (@calif_io) crediting @lcfr_hax as the first to discover php2shell. October 21, 2026.

There is real prior art behind this. Calif had already published Finding and Exploiting a 21-Year-Old Vulnerability in PHP, part of their Month of AI-Discovered Bugs series, which built the AI-assisted engine-auditing methodology that later cracked open php2shell. Cyber Army did not discover these CVEs. Our contribution, covered below, was getting detection and exposure coverage to our customers fast.

The race after disclosure

The flaws were reported privately in August 2026 and patched on October 21. Around patch day the technical details and the general shape of the bugs became public quickly, which turned the days after release into a race: defenders rushing to patch while others reverse-engineered the fix. Shortly after disclosure, Censys reported that roughly 1.5 million of 2.6 million scanned PHP hosts were still unpatched.

The window produced a flood of low-quality exploit code. Most public repositories claiming a working exploit were machine-generated and did not function: wrong field counts, wrong spray sizes, and offsets copied from one PHP build onto another. The reliable material came from researchers who understood the memory grooming, not from anyone who pasted a description into a model. The honest takeaway from the gap between disclosure and patch: a model could tell you what the bug was, but turning that into a reliable exploit was still expert work.

Government and agency warnings

The response escalated unusually fast. Japan's Prime Minister, @takaichi_sanae, posted a public appeal urging organizations to prepare for the patch, a rare level of head-of-government engagement for a single software CVE.

The U.S. National Security Agency's Cybersecurity Directorate issued a standalone public advisory as well, one of only a handful of times NSA Cyber has named a specific third-party CVE outside of known nation-state activity.

NSA Cybersecurity Directorate advisory urging organizations to prepare for the PHP update or take systems offline.
The NSA Cybersecurity Directorate (@NSACyber) advised preparing for the update, or taking systems offline if patching is not feasible.

Root cause: two bugs, one theme

php2shell is two bugs that share a theme: PHP being interrupted while a request is only half-built, and then treating that half-built state as if it were complete.

CVE-2026-109618, out-of-memory corruption. An attacker forces an out-of-memory fatal error at a chosen moment, for example with a single very large form-field name (Datadog reproduced the trigger with a field name of roughly 3.5 MB). The abort interrupts PHP mid-initialization, and the cleanup path then treats partly-initialized request structures as if they were fully built. Combined with a way to defeat ASLR, that mishandled state becomes a path to remote code execution.

CVE-2026-109619, stale global state. With session.upload_progress.enabled on, which is the shipped default, request-owned state can survive after the memory behind it has been freed, and a later request handled by the same worker reuses it (a use-after-free). On PHP 8.5 a fatal-error-backtrace code path contributes as well. That stale, reused state is what gives an attacker a controlled corruption primitive and, ultimately, code execution.

Both are classic consequences of error handling on a rare path: the code that runs when something has already gone wrong is exercised far less than the normal path, so an attacker who can force the error gets to drive logic that was never hardened against abuse.

The official fix

The PHP Foundation shipped an emergency release on October 21, 2026 that hardens the interrupted-cleanup paths, so a half-initialized request can no longer be mistaken for a complete one, and removes the stale-state reuse across requests. The maintainers are blunt about the takeaway: there are no complete mitigations, and updating is the only safe choice.

It is also a reminder that this class of bug is usually a small change once it is found, and that the hard part is the finding. Calif reached it by asking whether a decades-old PHP memory-handling bug class had really been cleaned out of modern code, then using an AI model (OpenAI's GPT-5.6 Sol) to turn that question into a reusable audit across the engine. That is a different shape of work than a human reading code line by line, and it is part of why several teams converged on the same bug within weeks.

How exploitation works

We are deliberately describing this at the level of mechanism, not providing a recipe.

CVE-2026-109618  (out-of-memory corruption)
  Force an out-of-memory fatal error at a chosen point, for
  example with one very large form-field name. Cleanup then
  treats half-initialized request data as valid. With a way
  to defeat ASLR, this becomes remote code execution.

CVE-2026-109619  (stale state, use-after-free)
  With session.upload_progress on (the default), request-owned
  state survives after it is freed; a later request on the same
  worker reuses it, giving a controlled corruption primitive
  and, ultimately, code execution.

Worker survival is the catch: on Apache mod_php (prefork) the
worker survives the fatal error and carries stale state into a
later request, which makes that setup the most reliable target.
On PHP-FPM the failure has to land after worker startup.

Two properties make this dangerous in practice. It needs no authentication and no application feature beyond PHP's own defaults, and on single-worker setups such as Apache prefork the reused state is reliable enough to matter. That combination, no login plus reliability on common configurations, is what moved php2shell from a serious CVE to a national-infrastructure concern within days.

Who is affected

PHP version matrix

BranchStatusFixed version
PHP 8.5Fixed in8.5.12
PHP 8.4Fixed in8.4.27
PHP 8.3Fixed in8.3.36
PHP 8.2Fixed in8.2.35
PHP 8.1, 8.0, 7.x, 5.x (>= 5.4)End of lifeNo fix - upgrade to 8.2 or later
PHP 8.1 and everything older (8.0, 7.x, and 5.x, affected back to 5.4) is end of life and will not receive a patch. The only real fix there is upgrading to a supported branch: 8.2 or later.

SAPI exposure

SAPIVulnerableNotes
Apache mod_php (prefork)YesSingle worker makes the exploit most reliable
PHP-FPM (nginx or Apache)YesMulti-worker, attacker retries across workers
LiteSpeedYesSame code path
CGIYesIf upload progress is enabled
CLINoNo network exposure

What to do right now

Patching is the only complete fix. Everything else here reduces exposure but does not close php2shell. Fixed releases: 8.5.12, 8.4.27, 8.3.36, 8.2.35. PHP 8.1 and older are end of life, so move to 8.2 or later. Advisories: GHSA-w8hw-w9fx-j79w (CVE-2026-109618) and GHSA-6wmf-4rv5-p3rp (CVE-2026-109619).
Free tool

Check your php2shell exposure in seconds

Our free scanner reads the signals your server already exposes, infers the OS and PHP branch even when the version is hidden, and gives you a clear verdict. Passive, no exploit payloads, no signup.

1. Patch PHP, then restart every worker

Update PHP on every runtime (web, queue workers, cron, containers), then restart Apache, PHP-FPM, and any long-running PHP process. Updating your application or framework does nothing here: the fix is in the PHP engine itself.

# Ubuntu / Debian (distro packages, or the deb.sury.org PPA)
sudo apt-get update && sudo apt-get upgrade

# RHEL / Alma / Rocky (AppStream or Remi)
sudo dnf update "php*"
dnf updateinfo | grep -i 2026-109618   # confirm the fix landed

# Docker: bump the base image to a fixed tag, then rebuild + redeploy
# FROM php:8.4.26-fpm   ->   FROM php:8.4.27-fpm

# Verify the version that actually serves requests, on every host
php -v                 # the CLI
php-fpm8.4 -v          # the FPM binary (this is what the web uses)
# expect 8.5.12, 8.4.27, 8.3.36, or 8.2.35 (or later)

Then restart, because running workers keep the old binary and settings in memory until they are recycled:

sudo systemctl restart php8.4-fpm     # PHP-FPM (nginx, or Apache + FPM)
sudo systemctl restart apache2        # Apache mod_php (prefork)

On end-of-life branches (8.1, 8.0, 7.x) there is no official fix. Unofficial community backports exist on the PHP source tree, but treat them as a last-resort stopgap, not a supported branch: the real fix is moving to 8.2 or later.

2. Find the php.ini that actually applies

The usual trap: each SAPI (the way PHP runs) loads its own php.ini, so editing the CLI file changes nothing for the web server. The php2shell settings below also cannot be set with ini_set() or a .user.ini; they must live in php.ini, a conf.d drop-in, or an FPM pool. Ask PHP which files it loads:

php --ini                               # the CLI's loaded files + the scan dir
php-fpm8.4 -i | grep "Loaded Configuration"   # the FPM binary that serves the web

# Typical layout on Debian / Ubuntu (one tree per version, per SAPI):
#   /etc/php/8.4/fpm/php.ini       and  /etc/php/8.4/fpm/conf.d/
#   /etc/php/8.4/apache2/php.ini   and  /etc/php/8.4/apache2/conf.d/
#   /etc/php/8.4/cli/php.ini
# RHEL family:  /etc/php.ini       and  /etc/php.d/

Prefer a numbered drop-in in conf.d over editing php.ini directly: it survives package upgrades and is trivial to remove once you have patched.

3. One-shot stopgap script (until you can patch)

If you genuinely cannot patch this minute, the script below writes a reversible drop-in for every installed PHP version and web SAPI, then restarts the running services. Run it as root on Debian/Ubuntu (RHEL paths are included). Read it first, and remember it reduces exposure, it does not fix php2shell.

#!/usr/bin/env bash
# php2shell-mitigate.sh - partial, reversible mitigations. Patch as soon as you can.
set -euo pipefail
[ "$(id -u)" -eq 0 ] || { echo "Run as root."; exit 1; }

for dir in /etc/php/*/fpm/conf.d /etc/php/*/apache2/conf.d /etc/php.d; do
  [ -d "$dir" ] || continue
  cat > "$dir/99-php2shell.ini" <<'INI'
; php2shell (CVE-2026-109618 / CVE-2026-109619) stopgap - delete after patching
session.upload_progress.enabled = 0
fatal_error_backtraces = 0
display_errors = 0
post_max_size = 8M
INI
  echo "wrote $dir/99-php2shell.ini"
done

# Restart running PHP-FPM services, and Apache if present, so settings apply
for svc in $(systemctl list-units --type=service --state=running --no-legend \
             | grep -oE 'php[0-9.]+-fpm' | sort -u); do
  systemctl restart "$svc" && echo "restarted $svc"
done
systemctl is-active --quiet apache2 && systemctl restart apache2 && echo "restarted apache2" || true

echo "Done. Verify:  php-fpm8.4 -i | grep upload_progress   (expect => 0)"
echo "Reverse later: delete the 99-php2shell.ini drop-ins and restart again."
The script deliberately leaves memory_limit alone, because removing it without a container or cgroup cap lets a single request exhaust host memory. See the setting notes below before you touch it.

4. The settings, and what each one does

SettingAddressesNotes
session.upload_progress.enabled = 0CVE-2026-109619 (UAF)The main precondition. Set in php.ini, a conf.d drop-in, or an FPM pool, not .user.ini or ini_set(). Restart workers.
fatal_error_backtraces = 0CVE-2026-109619 on 8.5Closes the fatal-backtrace path on PHP 8.5 only. Restart workers.
memory_limit = -1 (+ cgroup cap)CVE-2026-109618 (OOM)Removes the finite limit the trigger abuses, but only safe paired with a cgroup v2 memory.max that kills the worker. Never use RLIMIT_AS / RLIMIT_DATA, which hit the same bug. Set via php_admin_value so apps cannot re-enable a limit.
post_max_size / upload_max_filesizeCVE-2026-109618Lower to what you actually need (8M, or 32M with uploads). Also cap request size, field count, and multipart part count at the web server or proxy.
max_input_nesting_levelCVE-2026-109618Lower where the app allows; very complex forms may need more.
display_errors = 0HardeningKeeps PHP error output off the wire. Restart workers.
pm.max_requests = 1CVE-2026-109619 (FPM)Recycles each FPM worker after one request so stale state cannot carry over. Real performance cost.

If you can run a mandatory-access-control layer, SELinux or AppArmor confining the PHP workers (no spawning other programs, minimal capabilities) raises the bar on turning memory corruption into a working shell.

5. Filter at the edge (WAF and proxy)

Edge rules are a stopgap, and they only help if your origin accepts traffic exclusively from that edge. Cloudflare has shipped managed WAF rules for the known php2shell vectors (all plans, including free). Whatever sits in front of PHP, enforce a request-body limit and a multipart part-count cap there too:

# nginx (http or server block): cap the request body
client_max_body_size 8m;

# Apache (server or vhost): cap the request body, in bytes
LimitRequestBody 8388608

If a service does not need to be on the public internet, take it off: put it behind a VPN or SASE, or restrict access by source. Network or host IPS and virtual-patching signatures can block known exploit traffic as an interim layer, but like a WAF they do not repair the PHP runtime.

6. Stop advertising your PHP version

This patches nothing, but php2shell is being scanned at internet scale and there is no reason to hand a scanner your exact version. Turn off PHP's X-Powered-By, and silence the web server banner too, since PHP's setting does not control Apache or nginx:

; php.ini, or a conf.d drop-in, then restart PHP
expose_php = Off
# Apache (apache2.conf), then: sudo systemctl reload apache2
ServerTokens Prod
ServerSignature Off

# nginx (inside the http { } block), then: sudo systemctl reload nginx
server_tokens off;

Fingerprint reduction is a speed bump, not a fix. It slows version-targeted scanning, but a determined attacker can still probe behavior. Patching remains the only complete answer.

If you see the warning signs (unusually large or malformed PHPSESSID response cookies, odd multipart requests followed by memory-limit errors or repeated HTTP 500s, or unexplained PHP worker crashes), treat the host as potentially compromised: patch, then rotate any credentials it held, since process memory may have been exposed.

Detection

The trigger leaves a recognizable shape in access logs: an unusually large multipart POST to a PHP endpoint, often paired with a second, smaller POST from the same client moments later. Hunt for that pattern first.

# Apache / nginx: large non-file POST bodies to PHP
grep "POST.*\.php" access.log | awk '$10 > 16777216'

# Then look for a same-IP small POST within ~2s of a >16MB POST
# (the OOM trigger followed by the reclaim request).

At the network layer, these Suricata rules flag the two phases. Tune the sizes to your environment before deploying.

alert http $EXTERNAL_NET any -> $HTTP_SERVERS any (
  msg:"php2shell CVE-2026-109618 oversized upload-progress POST";
  flow:established,to_server;
  content:"PHP_SESSION_UPLOAD_PROGRESS"; http_client_body;
  dsize:>8000000;
  classtype:attempted-admin; sid:2026109618; rev:1;
)

alert http $EXTERNAL_NET any -> $HTTP_SERVERS any (
  msg:"php2shell CVE-2026-109619 upload-progress stale-state probe";
  flow:established,to_server;
  content:"PHP_SESSION_UPLOAD_PROGRESS"; http_client_body;
  dsize:>1000; dsize:<5000;
  classtype:attempted-recon; sid:2026109619; rev:1;
)

What Cyber Army saw

As soon as the details were public, we pushed updated AutoScan checks so that every PHP endpoint in a customer's authorized scope is tested for the php2shell preconditions and for the large-multipart trigger signature. We are watching for exploitation attempts and will flag them; at the time of writing, in-the-wild exploitation is not independently confirmed.

This research and detection work was led by Cyber Army's threat research team, Harshith Barri and Devansh Dubey. To be explicit about credit: the vulnerability itself was discovered by @lcfr_hax and Calif Research. Our job is to tell our customers, fast, whether their exposed PHP is vulnerable and whether anyone has tried the door.

Cyber Army customers: your php2shell exposure is reflected in your AutoScan results. Every in-scope PHP endpoint has been re-tested. If you need help prioritizing or remediating, reach out.

Our assessment

This is a Tier 1 emergency, for four reasons:

  • The responsible feature has been on by default since 2012, so the exposed population is enormous.
  • No authentication is required, and the technique is most reliable on common setups such as Apache mod_php.
  • There are no complete mitigations: the PHP maintainers say updating is the only safe fix.
  • Roughly 70 percent of internet-facing PHP is in scope, which is Log4Shell-class breadth.

If you run PHP on anything public, the priority order is simple: patch to a fixed release, since patching is the only complete fix. If you genuinely cannot patch yet, apply the partial mitigations above, then review your access logs for the trigger signature. Do it today.

Sources

  1. Calif Research: php2shell writeup, by @lcfr_hax, the original discoverer.
  2. Calif Research: Finding and Exploiting a 21-Year-Old Vulnerability in PHP, the prior-art unserialize UAF and AI-audit methodology.
  3. OpenAI: Patch the Planet, the coordinated disclosure of these PHP vulnerabilities, the primary source for the GPT-5.6 Sol discovery and the coalition response.
  4. Wiz: PHP2Shell, AI uncovers critical RCE affecting 70 percent of the internet.
  5. Tom's Hardware: OpenAI's GPT-5.6 Sol and the AI-assisted discovery, with the CVSS v4.0 9.2 rating and the "no complete mitigations" guidance.
  6. PHP Foundation: the October 21, 2026 emergency security releases (8.5.12, 8.4.27, 8.3.36, 8.2.35); PHP 8.1 and older are end of life.
  7. PHP bug #78876: the 2020 resource-leak report that previewed this bug class.
  8. OSTIF and Quarkslab PHP audit, 2024.
  9. Public posts referenced above from @takaichi_sanae and @NSACyber.
  10. The PHP Foundation: today's security release and how we are strengthening PHP security.
  11. Patchstack: PHP major vulnerability alert, interim mitigations and virtual-patching guidance.
  12. php2shell.com: fixed-version matrix, mitigations, and detection signals.
  13. Censys: live php2shell exposure and patch-progress dashboard across internet-facing PHP (CVE-2026-109618 / CVE-2026-109619).
  14. Related Cyber Army writing: Inside Mythos and AI pentest vs manual pentest.

Is your exposed PHP vulnerable to php2shell?

AutoScan tests your external attack surface the way an attacker would, including the php2shell preconditions, and tells you what is actually exploitable with evidence.