← All posts
Detections in my open-source library

Detecting PHP2Shell (CVE-2026-109618 and CVE-2026-109619) in Splunk and Cortex XDR

PHP2Shell gives unauthenticated remote code execution on PHP web servers and is exploited in the wild. How it works, how to find exposed hosts, and five tested detections for Splunk and Cortex XDR Pro, from the first memory error to the reverse shell.

Rayen Skhiri12 min read#PHP2Shell#Detection engineering#Splunk#Cortex XDR

On 21 October 2026 the PHP project shipped fixes for two bugs that, together, became known as PHP2Shell: CVE-2026-109618 and CVE-2026-109619. Both let an unauthenticated attacker run code on a PHP web server with crafted HTTP requests, both are rated CVSS 4.0 9.2, and both are already exploited. CISA added them to its Known Exploited Vulnerabilities catalog on 26 October.

This post explains what the bugs do, how to find the servers that are exposed, and how to detect exploitation in Splunk and Cortex XDR Pro. All five detections are in my detection library, with test events that must and must not fire, and you can try them in the playground.

9.2CVSS 4.0, both CVEs, no authentication
8.2 to 8.5fixed in 8.2.35, 8.3.36, 8.4.27, 8.5.12
In the wildattempts since 17 Oct, in CISA KEV since 26 Oct

What PHP2Shell is

Both bugs live in PHP itself, not in an application, and both start with an error inside a request.

  • CVE-2026-109618, memory corruption after running out of memory. If PHP hits memory_limit while it is still building the request data (for example $_POST from a large multipart body), part of that data is left half-built. When the request shuts down, PHP cleans it up as if it were valid, which corrupts memory.
  • CVE-2026-109619, stale state across requests. A fatal error can leave a worker-wide pointer aimed at memory that belonged to the previous request. The next request on the same worker uses it (a use-after-free). The confirmed paths are session upload progress, which is on by default even if the application never starts a session, and fatal_error_backtraces on PHP 8.5.

Two details matter for defenders. First, PHP parses the request before any application code runs, so a login page or a WAF rule inside the app does not help: any PHP script reachable over HTTP is enough. Apache mod_php is the highest-risk setup, because a working exploit was demonstrated there with default limits. PHP-FPM, php-cgi, FrankenPHP and LiteSpeed are in scope too. Second, a successful exploit can still return HTTP 200: there is no guaranteed crash or error page to wait for.

Affected and fixed versions

BranchFixed in
PHP 8.58.5.12
PHP 8.48.4.27
PHP 8.38.3.36 (Ubuntu 24.04: 8.3.6-0ubuntu0.24.04.13, USN-8948-1)
PHP 8.28.2.35
PHP 7.4 to 8.1No official release: distribution packages or PHP's source backports only
PHP 7.3 and olderEnd of life, no fix: upgrade the branch

Distributions backport fixes without changing the upstream version number, so always check your vendor's advisory rather than comparing version strings.

Timeline

Date (2026)What happened
17 OctoberAmazon sees a first exploitation attempt on its honeypots, four days before disclosure
20 OctoberDetails leak before the coordinated release; a tool called "PHP2Shell" appears
21 OctoberPHP releases fixes and advisories; more attempts reported the same day
24 OctoberA researcher reports honeypots running PHP 8.4.26 successfully exploited
26 OctoberCISA adds both CVEs to KEV; Trail of Bits reports working exploits on PHP 8.2 to 8.5

If you run internet-facing PHP, start your investigation window on 17 October, not on the disclosure date.

Step 1: find what is exposed

Patching comes first, so start by finding every host that runs a PHP web runtime. In Cortex XDR Pro with the Host Insights add-on, the vulnerability assessment can be searched by CVE ID. To get a list from telemetry right away, this query shows every host that started a PHP worker or a web server that may load mod_php:

config case_sensitive = false
| dataset = xdr_data
| filter event_type = ENUM.PROCESS and event_sub_type = ENUM.PROCESS_START
| filter action_process_image_path ~= "/(php-fpm[0-9.]*|php-cgi[0-9.]*|apache2|httpd|frankenphp|lsphp[0-9]*)$"
| comp count() as starts by agent_hostname, action_process_image_path
| sort asc agent_hostname

On each host, confirm the version of the PHP that serves web requests (the CLI php can be a different build) and the interim settings:

# Which PHP packages are installed (Debian / Ubuntu)
apt list --installed 2>/dev/null | grep -E '^(php|libapache2-mod-php)[0-9.]*[-/]'

# The PHP that serves web requests can differ from the CLI one: ask each runtime
php -v
php-fpm8.3 -v 2>/dev/null

# Interim settings for CVE-2026-109619 (check the web SAPI's php.ini, not only the CLI one)
grep -RhoE '^\s*(session\.upload_progress\.enabled|fatal_error_backtraces|memory_limit)\s*=.*' /etc/php/*/apache2/ /etc/php/*/fpm/ 2>/dev/null

Step 2: detect exploitation, one layer at a time

No single signal proves PHP2Shell. The attack starts with memory errors in the web server log, may crash a few workers, and ends with a process under the web user. Watching every layer is what makes it detectable. The rules below are compiled from one YAML source to both languages; the Splunk SPL expects a sysmon macro for Sysmon for Linux and an apache_error macro for the Apache error log, and the Cortex XDR XQL reads agent telemetry (xdr_data) and the Apache error log sent with an XDR Collector (apache_httpd_raw, rename it if your dataset is called something else).

Layer 1: the probe, PHP runs out of memory before the script

CVE-2026-109618 is triggered by exhausting memory_limit during request parsing. When that happens before any script line runs, PHP logs the error against Unknown on line 0. An out-of-memory error inside a real script names the file and line instead, which is what keeps this rule quiet on normal application bugs.

DL-0066 PHP ran out of memory before any script line ranrule page and tests

Cortex XDR (XQL)

config case_sensitive = false
| dataset = apache_httpd_raw
| filter _raw_log != null
| filter _raw_log contains "allowed memory size of" and _raw_log contains "exhausted" and _raw_log contains "unknown on line 0"
| fields _time, _raw_log
| sort desc _time
| limit 1000

Splunk (SPL)

`apache_error`
| where match(_raw, "(?i)allowed\\ memory\\ size\\ of") AND match(_raw, "(?i)exhausted") AND match(_raw, "(?i)unknown\\ on\\ line\\ 0")
| table _time host _raw
| sort - _time

One event is a lead. Several from the same client in a short window is a pattern, so I alert on the correlation:

Splunk: 5 or more early OOM errors from one client in 2 minutes

`apache_error` "Allowed memory size of" "Unknown on line 0"
| rex "\[client (?<client_ip>[0-9a-fA-F\.:]+):\d+\]"
| bin _time span=2m
| stats count as oom_errors values(host) as hosts by _time client_ip
| where oom_errors >= 5
| sort - oom_errors

Cortex XDR: same correlation

config case_sensitive = false
| dataset = apache_httpd_raw
| filter _raw_log contains "allowed memory size of" and _raw_log contains "unknown on line 0"
| alter client_ip = arrayindex(regextract(_raw_log, "\[client ([0-9a-fA-F\.:]+):\d+\]"), 0)
| bin _time span = 2m
| comp count() as oom_errors by _time, client_ip
| filter oom_errors >= 5
| sort desc oom_errors

Layer 2: workers crashing

Memory corruption exploits often crash a few workers before one attempt lands. On an internet-facing PHP server, Apache AH00052 ... Segmentation fault or PHP-FPM exited on signal 11 is worth a look, especially right after Layer 1.

DL-0067 Web server or PHP-FPM worker crashed with a segmentation faultrule page and tests

Cortex XDR (XQL)

config case_sensitive = false
| dataset = apache_httpd_raw
| filter _raw_log != null
| filter _raw_log ~= "(?i)ah0005[12].*segmentation fault" or _raw_log contains "exited on signal 11"
| fields _time, _raw_log
| sort desc _time
| limit 1000

Splunk (SPL)

`apache_error`
| where match(_raw, "(?i)ah0005[12].*segmentation fault") OR match(_raw, "(?i)exited\\ on\\ signal\\ 11")
| table _time host _raw
| sort - _time

Layer 3: code execution, a shell under the web worker

This is the most reliable signal. After exploitation, the command runs as the web user (www-data on Ubuntu) as a child of the Apache or PHP-FPM worker. The rule excludes sh -c sendmail, which PHP's mail() uses every day.

DL-0063 Web server or PHP worker starts a shell or download toolrule page and tests

Cortex XDR (XQL)

config case_sensitive = false
| dataset = xdr_data
| filter event_type = ENUM.PROCESS and event_sub_type = ENUM.PROCESS_START
| filter (actor_process_image_path ~= "(?i)/(apache2|httpd|nginx|php-fpm[0-9.]*|php-cgi[0-9.]*|frankenphp|lsphp[0-9]*|litespeed|lshttpd)$" and action_process_image_path ~= "(?i)/(sh|bash|dash|zsh|ksh|busybox|nc|ncat|netcat|socat|curl|wget|python[0-9.]*|perl|ruby|id|whoami|uname|hostname|base64|chmod)$") and not ((action_process_image_command_line != null and (action_process_image_command_line contains "sendmail" or action_process_image_command_line contains "/usr/sbin/exim" or action_process_image_command_line contains "postdrop")))
| fields _time, agent_hostname, actor_effective_username, actor_process_image_name, action_process_image_name, action_process_image_command_line
| sort desc _time
| limit 1000

Splunk (SPL)

`sysmon` EventCode=1
| eval process_name=lower(mvindex(split(Image,"\\"),-1)), parent_name=lower(mvindex(split(ParentImage,"\\"),-1))
| where (match(ParentImage, "(?i)/(apache2|httpd|nginx|php-fpm[0-9.]*|php-cgi[0-9.]*|frankenphp|lsphp[0-9]*|litespeed|lshttpd)$") AND match(Image, "(?i)/(sh|bash|dash|zsh|ksh|busybox|nc|ncat|netcat|socat|curl|wget|python[0-9.]*|perl|ruby|id|whoami|uname|hostname|base64|chmod)$")) AND NOT ((isnotnull(CommandLine) AND (match(CommandLine, "(?i)sendmail") OR match(CommandLine, "(?i)/usr/sbin/exim") OR match(CommandLine, "(?i)postdrop"))))
| table _time host User ParentImage Image CommandLine
| sort - _time

The next thing attackers usually run is a reverse shell, which has a very recognisable command line:

DL-0064 Reverse shell one-liner on Linuxrule page and tests

Cortex XDR (XQL)

config case_sensitive = false
| dataset = xdr_data
| filter event_type = ENUM.PROCESS and event_sub_type = ENUM.PROCESS_START
| filter action_process_image_command_line ~= "(?i)(/dev/(tcp|udp)/|\\bbash\\s+-i\\b|\\bnc(at)?\\b.*\\s-(e|c)\\s|mkfifo\\s|socat\\b.*exec:|socket\\.socket\\(|pty\\.spawn\\(|IO::Socket::INET)"
| fields _time, agent_hostname, actor_effective_username, actor_process_image_name, action_process_image_name, action_process_image_command_line
| sort desc _time
| limit 1000

Splunk (SPL)

`sysmon` EventCode=1
| eval process_name=lower(mvindex(split(Image,"\\"),-1)), parent_name=lower(mvindex(split(ParentImage,"\\"),-1))
| where match(CommandLine, "(?i)(/dev/(tcp|udp)/|\\bbash\\s+-i\\b|\\bnc(at)?\\b.*\\s-(e|c)\\s|mkfifo\\s|socat\\b.*exec:|socket\\.socket\\(|pty\\.spawn\\(|IO::Socket::INET)")
| table _time host User ParentImage Image CommandLine
| sort - _time

Layer 4: persistence, a web shell in the web root

Once in, attackers drop a PHP file so they can come back after the patch. A .php, .phtml or .phar file written by the worker or a shell under the web root is worth opening:

DL-0065 PHP file written in the web root by the web server or PHP workerrule page and tests

Cortex XDR (XQL)

config case_sensitive = false
| dataset = xdr_data
| filter event_type = ENUM.FILE and event_sub_type in (ENUM.FILE_CREATE_NEW, ENUM.FILE_WRITE)
| filter actor_process_image_path ~= "(?i)/(apache2|httpd|nginx|php-fpm[0-9.]*|php-cgi[0-9.]*|frankenphp|lsphp[0-9]*|dash|sh|bash|curl|wget)$" and action_file_path ~= "(?i)^/(var/www|srv/www|srv/http|usr/share/nginx)/.+\\.(php[0-9]?|phtml|phar|pht)$"
| fields _time, agent_hostname, actor_process_image_name, action_file_path
| sort desc _time
| limit 1000

Splunk (SPL)

`sysmon` EventCode=11
| eval process_name=lower(mvindex(split(Image,"\\"),-1)), file_name=lower(mvindex(split(TargetFilename,"\\"),-1))
| where match(Image, "(?i)/(apache2|httpd|nginx|php-fpm[0-9.]*|php-cgi[0-9.]*|frankenphp|lsphp[0-9]*|dash|sh|bash|curl|wget)$") AND match(TargetFilename, "(?i)^/(var/www|srv/www|srv/http|usr/share/nginx)/.+\\.(php[0-9]?|phtml|phar|pht)$")
| table _time host Image TargetFilename
| sort - _time
For Cortex XDR Pro users: the XDR agent's behavioural protection may already block or alert on some of this. These queries are for hunting back to 17 October and for turning into BIOC or correlation rules once you have checked them on your own data. They have been tested against the rules' own events, not on a live tenant, so run each one once before you rely on it.

Step 3: respond

  1. Preserve evidence before you restart anything. A restart wipes the worker memory, and with it the best evidence of what was sent. Copy the Apache access and error logs, the PHP-FPM log and the web root.
  2. Patch and restart every worker. Updating the package does not fix PHP processes that are already running.
  3. Use the interim settings only as a bridge. session.upload_progress.enabled = 0, and fatal_error_backtraces = 0 on PHP 8.5, reduce exposure to CVE-2026-109619. For CVE-2026-109618, PHP suggests memory_limit = -1 with request size limits at the reverse proxy, which brings its own denial-of-service risk. None of these is a fix.
  4. Hunt for what was left behind. New PHP files in the web root, cron entries and new accounts created by the web user, and outbound connections from the server that you cannot explain.
  5. Reduce exposure. Keep unpatched PHP off the internet, and prioritise mod_php servers.

The detections

RuleWhat it catches
DL-0066PHP out of memory before the script (the CVE-2026-109618 trigger)
DL-0067Apache or PHP-FPM worker segfault
DL-0063Shell, download tool or recon command under a web worker
DL-0064Reverse shell one-liners
DL-0065PHP file written in the web root

Every rule ships with events that must fire and events that must not, and CI runs the compiled XQL and SPL against them on every commit. If one of them misbehaves on your platform, open an issue on the repo with the error and I will fix it.

Sources

Thanks for reading. Running PHP on Splunk or Cortex XDR and want to compare notes on these detections? I reply within a day.