HuntIQ Tradecraft: Hunting php2shell Post-Exploitation with Tanium
HuntIQ Tradecraft: Hunting php2shell Post-Exploitation with Tanium
php2shell is two flaws in the PHP core, CVE-2026-109618 and CVE-2026-109619, that let an unauthenticated web request reach code execution inside the PHP worker that handles it. The request that triggers it lives in the HTTP body, which endpoint telemetry does not record, so this walkthrough hunts the two things an endpoint does show: where PHP runs and how exposed each copy is, and what a compromised PHP worker does afterward. A hit in Steps 1 and 2 tells you a host is exposed. A hit in Steps 3 through 7 means something on a PHP server behaved the way an operator would after gaining code execution, and a person needs to look at it. The reader is a hunter who builds questions in the question builder, so every step carries the TQL to paste into Interact or adapt.
Key takeaways
-
php2shell reaches code execution as the web service account before any application code runs, so it leaves no application-log trace and the usual alert sources stay quiet (T1190 Exploit Public-Facing Application).
-
Apache's bundled PHP module carries the highest risk, and on those hosts PHP has no process of its own: the parent of anything it launches is
apache2orhttpd, notphp. -
Exploitation attempts began on October 17, four days before disclosure, so every lookback starts there, not on release day.
-
A version check is the wrong exposure test on its own: distribution backports keep the old version string, Windows PHP is usually unpacked rather than installed, and PHP inside a container image never shows up in the host's package list.
-
The Guardian dashboard for the two CVEs answers the exposure question with no setup, and a new sensor reads the version straight from each Windows PHP binary without running it.
-
Threat Response Recorder history already holds the process, file and network events from before the advisory, and it sees inside containers, so the behavior hunt works after the fact.
-
The pivot that ties any hit back to php2shell is a shell or discovery command whose parent is a PHP or web server worker and whose user is the web service account; the file writes and connections from that same worker are the companion pivots.
Before you start
|
Requirement |
Detail |
|
|
Modules |
Tanium Threat Response with the Recorder collecting process, file and network events; Tanium Index for the Windows binary check; Tanium Guardian Emerging Issues Content 1.25.60 or later for the dashboard and the Windows PHP Installations sensor. |
|
|
Content sets |
Threat Response (the |
|
|
Endpoints |
Windows, Linux and macOS web servers and developer workstations. Each step names its platforms. |
|
|
RBAC |
Every question here needs the platform |
Not covered: the exploit request body, web server access logs, and PHP on hosts without the Tanium Client such as appliances and managed hosting.
How php2shell leads to code execution
Both flaws come from the same place: when PHP hits a fatal error, including an out-of-memory condition, it abandons what it was doing. CVE-2026-109618 is reached when that happens part-way through parsing a request, leaving request state that later cleanup still trusts. CVE-2026-109619 leaves state from a failed request in place for the next request on the same worker, where code that runs before normal startup, most often session upload progress, which is on by default, reads it. Either path ends in remote code execution as the web service account. PHP's advisories are the authoritative description of each (CVE-2026-109618, CVE-2026-109619).
The highest risk is Apache's bundled PHP module, mod_php, where the flaw is reachable before application code runs. PHP-FPM is exposed through the same upload-progress path for CVE-2026-109619. PHP fixed both in 8.5.12, 8.4.27, 8.3.36 and 8.2.35 on October 21, 2026, with source backports for 7.4, 8.0 and 8.1 (php.net). PHP says updating is the only reliable fix: turning off session upload progress removes the confirmed path for CVE-2026-109619 and does nothing for CVE-2026-109618. Request-shape limits belong at a WAF or proxy, and several vendors shipped rules for them; this walkthrough stays on the endpoint.
What attackers did with it
Amazon's honeypots logged the first attempt on October 17 and more from several sources in the early hours of October 21 (AWS). ELLIO recorded a loader that pulled an ELF binary into /tmp and a canary that ran uname -a; id (ELLIO). VulnCheck's canaries caught a failed attempt to drop a web shell through the upload-progress path (VulnCheck). As of October 22 no public source had confirmed a successful compromise, and neither CVE was in CISA's Known Exploited Vulnerabilities catalog (Tenable). The public exploits were widely called unreliable, but HuntIQ's own lab work reached code execution over HTTP alone against unpatched 8.5.11, so treat that unreliability as a lag in public tooling rather than a safety margin; the companion analysis, Why php2shell Is Real and Still Hard to Exploit, has the detail.
That is what the behavior hunt looks for: the cheapest next moves those attempts showed. Run a discovery command, pull a second stage into a staging directory, write a web shell so access outlives the patch, and connect out (T1059 Command and Scripting Interpreter, T1105 Ingress Tool Transfer, T1505.003 Web Shell).
Choosing which identifiers to hunt
The questions below key on behavior, because the published indicators are thin and the infrastructure is anonymization services. Use the indicators as a cross-check on Step 6's remote addresses and on your web server logs, not as the primary hunt. Indicators decay, so check each source for updates before relying on it.
|
Type |
Indicator |
Source and date |
|
IPv4 (anonymization infrastructure; investigate, do not blind-block) |
|
AWS, Oct 17-21, 2026 |
|
User-Agent |
|
|
|
URL |
|
ELLIO, Oct 21, 2026 |
|
SHA-256 |
|
ELLIO, Oct 21, 2026 |
The process-name set in the regexes below is the realistic range of PHP and web server workers: httpd and apache2 for mod_php, php-fpm for FPM pools, php-cgi and w3wp for IIS FastCGI, lsphp for LiteSpeed, and frankenphp for FrankenPHP. Trim it to what Step 2 says you actually run.
Every Trace question here uses the same output settings, and they matter. MakeStackable is "0", which returns one row per event with the endpoint and timestamp; at "1" the results collapse into a prevalence view and drop both. MaxResultsPerHost is "100", because the default returns one row per host and a busy web server fills the cap quickly. TreatInputAsRegEx is "1" because every filter is a regular expression, and Trace regexes match against the whole field, so each pattern opens with .* and carries (?i) for case. The Trace sensors cache for 900 seconds, so a brand-new event can take up to 15 minutes to appear. A "1 week" lookback reaches October 17 only if you run these before October 24; after that, set TimeRange to "absolute time range" and pass a window starting October 17 in AbsoluteTimeRange.
Step 1: Find every copy of PHP
Tanium Guardian: open the Reporting dashboard named CVE-2026-109618 and CVE-2026-109619: PHP Remote Code Execution Vulnerabilities. It counts and charts vulnerable PHP on Windows, Linux and macOS, and its own note warns that distribution backports keep the upstream version string, so a backported-but-patched Linux package can still read as vulnerable. Start there, then run the questions below for the hosts the dashboard cannot reach.
On Windows, read the version from the binary rather than the installer list, because PHP on Windows is usually unpacked from a zip.
Get "Computer Name" and "Windows PHP Installations" from all machines with "Is Windows" equals "True"
Returns Version, Install Type, Install Path and Username per Windows host. The Version column is a real version type, so it compares correctly against the fixed releases. This sensor ships in Guardian Emerging Issues Content 1.25.60, caches for 12 hours, and reports No PHP installations found as a row rather than an empty result. It reads standard install locations; a copy dropped in an unusual path shows up in Step 2 or in the BAM check below instead.
For packaged PHP on Linux, and anything Windows registered as installed software:
Get "Computer Name" and "Installed Applications" having "Installed Applications":"Name" contains "php" from all machines with "Installed Applications":"Name" contains "php"
Returns Name and Version. Caches for one hour. Two blind spots decide how you read it: a distribution backport reports the old upstream version (Ubuntu 24.04's fixed build still says 8.3.6), so compare against the vendor advisory or the Guardian report logic rather than the number alone; and this sensor never sees PHP compiled from source or carried inside a container image.
On macOS, Homebrew is the common source:
Get "Computer Name" and "Homebrew Applications" having "Homebrew Applications":"Application/Package" starts with "php" from all machines with "Is Mac" equals "True" and "Homebrew Applications":"Application/Package" starts with "php"
Returns Application/Package and Version. Caches for four hours. Version is a string with Homebrew's revision suffix (8.4.12_1), so compare the leading major.minor.patch against the fixed releases. Reports Homebrew is not installed as a row.
Where Index covers your Windows web roots, you can locate the binary and its hashes directly:
Get "Computer Name" and "Index - File Details"["100","*","(?i)^(php|php-cgi|php-win)\.exe$|^php8(ts)?\.dll$","*","*","*","*","*","*","1","0","",""] from all machines with "Is Windows" equals "True"
Returns Directory Path, File Name, Object Type, size, timestamps and the MD5/SHA1/SHA256/SHA512 hashes. It does not return a version, so use it to find copies the inventory missed and read the version from Step 1's Windows PHP Installations or from the folder name. Index must be enabled and must cover the path; No Results Found is a row.
For historical PHP execution on Windows hosts without Threat Response, the Background Activity Moderator keeps about a week of per-user execution:
Get "Computer Name" and "Windows BAM Entries" contains "php" from all machines with "Is Windows" equals "True" and "Windows BAM Entries" contains "php"
Returns one column of \Device\HarddiskVolumeN\... paths. No timestamp or user; use Windows Detailed BAM Entries for those. Windows 10 1709 and Server 2019 and later, interactive-user processes only.
Step 2: Confirm which SAPI each host runs
How PHP is served decides every later step: mod_php hides PHP behind the web server process, while FPM and CGI keep it visible.
Get "Computer Name" and "Running Processes With Parent" from all machines with "Running Processes With Parent" matches ".*([pP][hH][pP]|[hH][tT][tT][pP][dD]|[aA][pP][aA][cC][hH][eE]2|[lL][sS][pP][hH][pP]|[fF][rR][aA][nN][kK][eE][nN][pP][hH][pP]|[wW]3[wW][pP]).*"
Returns Process and Parent. This is live state, cached for 10 minutes, and Process holds the full command line, so an FPM master reads as php-fpm: master process (...). Two things to know about the match. TQL cannot filter on one subcolumn of this sensor, so the condition runs against the whole process line and a matching host returns its entire process list; filter the returned rows down to the real workers. The match is also a substring, so it hits command-line arguments and paths, not just the process name: an Apache cache-cleaner whose path contains apache2 will match, for example. The character classes are spelled out because the match is case-sensitive. Read the result as a map: php-fpm means the FPM path; php-cgi under w3wp means IIS FastCGI; PHP visible only as apache2 or httpd workers with no php process means mod_php, and those hosts need Steps 3 through 6 keyed on the web server parent, not on php.
Step 3: Hunt shells and discovery commands from PHP and web server workers
This is the core of the hunt. A successful exploit runs attacker code inside the worker, and the first visible act is usually a shell or a discovery command.
Start with standalone interpreters (FPM and CGI), where PHP is the parent:
Get "Computer Name" and "Trace Executed Processes"["1 week","","1","0","100","0","","(?i).*[\\/]php(-cgi|-fpm|-win)?[0-9.]*(\.exe)?$","","","",""] from all machines
Returns the endpoint, start and end time, parent and child process paths, command line, MD5 and user. Every child of a PHP interpreter is a candidate. On a mod_php host this returns nothing useful, because PHP is not the parent there, which is the point of the next query.
For mod_php and for any worker, filter on the web server or PHP worker as the parent and a shell or living-off-the-land binary as the child:
Get "Computer Name" and "Trace Executed Processes"["1 week","","1","0","100","0","(?i).*[\\/](sh|bash|dash|zsh|cmd|powershell|pwsh|curl|wget|nc|ncat|socat|perl|python[0-9.]*|certutil|whoami|id|uname)(\.exe)?$","(?i).*[\\/](httpd|apache2|w3wp|lsphp|frankenphp|php(-cgi|-fpm|-win)?[0-9.]*)(\.exe)?$","","","",""] from all machines
Same columns. A web server legitimately forks its own workers (apache2 starting apache2), and the child regex excludes that, so what remains is a web server or PHP worker starting a shell, a downloader or a discovery tool. Review every row.
On Linux, the web service account is the sharpest filter, because a shell running as www-data or apache almost never happens in normal operation:
Get "Computer Name" and "Trace Executed Processes"["1 week","","1","0","100","0","(?i).*[\\/](sh|bash|dash|zsh|curl|wget|nc|ncat|socat|perl|python[0-9.]*|whoami|id|uname)$","","","","","(?i)^(www-data|apache|nginx|nobody)$"] from all machines with "Is Linux" equals "True"
Same columns, Linux only, filtered on the user rather than the parent. One benign pattern will show up and you should name it before you hunt: Tanium's own package inventory runs sh -c rpm -qa --queryformat ... as nobody, with su or an unknown process as the parent. Exclude that shape, or drop nobody from the pattern, and what remains is a web account running a shell.
Step 4: Hunt web shells and payloads written by a worker
A worker that writes a .php file into a web-served directory, or an executable anywhere, is dropping persistence or a second stage.
Get "Computer Name" and "Trace File Operations"["1 week","","1","0","100","0","(?i).*\.(php[0-9]?|phtml|phar|pht|exe|dll|ps1|bat|cmd|vbs|hta|sh|so)$","","(?i).*[\\/](httpd|apache2|w3wp|lsphp|frankenphp|php(-cgi|-fpm|-win)?[0-9.]*)(\.exe)?$","",""] from all machines
Returns the endpoint, timestamp, file path, operation, writing process path and user. The writer filter uses the web server names, not just php, because on mod_php the write is attributed to apache2 or httpd. Leaving Operation blank returns all of create, write, delete and rename. Expect benign noise from CMS updates, plugin installs and compiled template caches (WordPress, Laravel, Smarty), which write .php under cache, storage, vendor or plugin directories. A new .php or .phtml in an upload or document-root folder, a .phar outside a vendor tree, or any .exe, .dll, .so, .ps1 or .sh written by a worker is the candidate. Read the file and check the web server access log for the host around that timestamp.
Step 5: Hunt staging-directory writes (Linux)
Second stages land in world-writable directories first.
Get "Computer Name" and "Trace File Operations"["1 week","","1","0","100","0","(?i).*/(tmp|var/tmp|dev/shm)/.*","","(?i).*/(httpd|apache2|lsphp|frankenphp|php(-cgi|-fpm)?[0-9.]*)$","",""] from all machines with "Is Linux" equals "True"
Same columns, Linux only. The path pattern is deliberately unanchored (.*/(tmp|...)), not anchored at ^/tmp, because the Recorder records a container's file writes under the host's overlay path (/var/lib/docker/.../overlayfs/<id>/...), and an anchored pattern would miss every containerized PHP server. One benign shape recurs: httpd writing apr-tmp.* files under a systemd PrivateTmp path (/tmp/systemd-private-...-httpd.service-.../tmp/). Everything else a worker drops into a staging directory is worth reading.
Step 6: Hunt outbound connections from a worker
A web server worker that opens an outbound connection to something other than its database or cache is reaching for a second stage or calling home.
Get "Computer Name" and "Trace Network Connections"["1 week","","1","0","100","0","0","","","","","(?i).*[\\/](httpd|apache2|w3wp|lsphp|frankenphp|php(-cgi|-fpm|-win)?[0-9.]*)(\.exe)?$","",""] from all machines
Returns the endpoint, time, the writing process (the column is named Process ImagePath), user, operation, and local and remote address and port. Three things to know: the process filter is the twelfth parameter in this sensor, not the eighth; IncludeLocalhost at "0" excludes only IPv4 127.0.0.1, so IPv6 ::1 health checks still appear; and a busy server mixes its own inbound and accepted traffic into the results. Triage on the remote address, not the volume: a connection to an external host you do not recognize, especially one in the indicator table or your web logs, is the lead.
Step 7: Check for crash evidence
A failed or noisy exploitation attempt can crash the worker, and on Windows that leaves an Application Error.
Get "Computer Name" and "Application Crashes in Last X Days"["30"] having "Application Crashes in Last X Days":"Process" matches "(php-cgi\.exe|php\.exe|w3wp\.exe)" from all machines with "Is Windows" equals "True" and "Application Crashes in Last X Days"["30"]:"Process" matches "(php-cgi\.exe|php\.exe|w3wp\.exe)"
Returns the crashing Process. It reads Application-log event 1000 from the source Application Error over the chosen number of days (max 365). For the event message text, search the log directly:
Get "Computer Name" and "Generic Event Log Search"["Application","1000","php","720"] from all machines with "Is Windows" equals "True"
Returns the time, event ID, level, source and a message truncated to 150 characters, over the chosen lookback in hours. Event ID 1000 in the Application log is shared with a Microsoft-Windows-LoadPerf informational event, so filter on Source equal to Application Error. On Linux, the equivalent signals are in the web server and PHP-FPM logs, which no shipped Tanium sensor reads fleet-wide; cover those with your log pipeline. Treat crash evidence as context, not proof: a crash can mean a failed attempt, and a quiet host is not a clean one.
Reading the results
Work the hits in this order. A Step 3 shell from a web account or web server worker is the strongest single signal; confirm it against Steps 4 through 6 on the same host and the same time window. A Step 4 web shell in a served directory stands on its own. Steps 5, 6 and 7 are supporting evidence that sharpen a Step 3 or Step 4 hit, or that, taken together on one host, justify a closer look even without a shell.
The benign baseline, so you can set it aside fast: web servers fork their own workers; CMS and framework caches write .php under cache and vendor paths; httpd writes APR temp files under systemd private-tmp; httpd opens ::1 health checks; and Tanium's package inventory runs a shell as nobody. None of these is a worker starting a shell as a web account, writing a web shell into a document root, or connecting to an unknown external host.
The exposure these questions do not cover
Container images are the gap. A vulnerable PHP inside an image is invisible to the Guardian dashboard and to Installed Applications, because inventory describes the host, not the images it runs. A server whose own PHP is patched can still run a vulnerable php:8.5.11-apache container. Two things reach it: Step 2's Running Processes With Parent shows the container's apache2 -DFOREGROUND with a containerd-shim parent, and the Trace steps see the container's process and file activity under the host's overlay paths. Hosts without the Tanium Client, such as appliances that embed PHP and managed hosting, are outside every one of these questions; scope them separately.
What this hunt does and does not establish
These questions find the behavior that follows code execution, not the exploit itself. The triggering request is an HTTP body that no endpoint sensor records, so a clean result across Steps 3 through 7 means no post-exploitation behavior was recorded in the lookback and the Recorder's retention bounds that lookback. It is not proof that no host was reached. It is also worth knowing that php2shell runs its code inside the PHP worker before application code, and an operator who only read memory or staged entirely in-process may never fork a child or write to disk, in which case Steps 3 through 5 stay quiet by design. Read the exposure in Steps 1 and 2 as the standing risk, and the behavior hunt as the search for a specific host that acted on it. A hit is a lead to confirm, not a verdict.
One part of the attack is visible, but at the web tier rather than the endpoint. The stale-state flaw can be steered to disclose process memory in the response's session cookie, so a Set-Cookie: PHPSESSID= value that is not 32 lowercase hexadecimal characters, or that is unusually long, is a possible sign of an in-band memory read (Wiz). No Tanium sensor reads response headers, so this belongs in your proxy, WAF or web server logging alongside the request-shape rules those vendors published; it is the detection complement to the endpoint hunt above. The companion analysis explains why this disclosure matters.
Next steps
-
Patch to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 (or your distribution's fixed backport), prioritizing internet-facing mod_php hosts, and restart every PHP and web server worker so no worker keeps stale state.
-
Keep Step 1 as a standing exposure question and watch the number fall as patching lands; rerun Steps 3 through 7 against an absolute window starting October 17 once your
"1 week"lookback no longer reaches it. -
Where you have Threat Response, consider promoting Step 3 into a saved question or a scheduled hunt so a new worker-spawned shell surfaces without being asked for.
-
Read the companion analysis, HuntIQ Tradecraft: Why php2shell Is Real and Still Hard to Exploit, for what reproduction showed about which hosts are genuinely reachable.
About HuntIQ
HuntIQ is Tanium's threat hunting practice. Our hunters go hands-on-keyboard in customer environments, running hunt campaigns against live telemetry, triaging what surfaces, pivoting from one endpoint to the whole estate, and escalating with the evidence already attached. Alongside that we build the durable content behind it, the Signals, hunt packages, and recurring hunts your own analysts can run without us.