PHP2SHELL RESPONSE: DEFENSIVE HUNT COMPANION
Deception Check | 2026-10-21 | Experimental hunt starters

These are generic behavioral hunts and static triage examples, not CVE-specific
signatures, vulnerability scanners, proof of exploitation, or prevention guarantees.
No match does not mean a host is safe. Patching and runtime inventory remain primary.

AUTHORING AND BUILD COPIES
This detections/ directory is the corrected release working copy. The original
source packet is retained separately. Mirror this reviewed working copy into the
public detections directory and download ZIP; do not mix original and revised files.
Keep internal review and validation records out of public deployment directories.

ADVISORY CONTEXT
The PHP project's OOM advisory, CVE-2026-109618, concerns invalid request state on
an early out-of-memory exit. Its stale-global-state advisory, CVE-2026-109619,
concerns request-owned state surviving in a worker and being consumed later.
Neither a shell process nor a memory error establishes either mechanism.
Official advisories list patched releases 8.2.35, 8.3.36, 8.4.27, and 8.5.12.
Verify distribution backports and the loaded web-worker runtime, not only CLI PHP.
Do not reproduce exploit requests to test these examples.

CONTENTS AND VERIFICATION LEVEL
linux_web_child.yml: Sigma process-creation hunt. JSON-compatible YAML serialization.
  UTF-8/LF. Offline JSON parsing, selected structural checks, modeled predicates.
  Both ParentImage and Image now use case-sensitive re selectors. The original
  packet's pySigma result applies to the earlier child selector, not this revision.
  Current-revision pySigma parsing, backend conversion, and SIEM execution NOT run.
  Backend must support both re selectors and correct ParentImage/Image mapping.
defender_web_child.kql: native Defender XDR DeviceProcessEvents hunt.
  Field names checked against official schema; extracted predicates tested offline.
  KQL-engine parsing and tenant execution NOT run. Confirm ProcessCreated is present
  in the tenant's in-portal ActionType reference and known-good Linux event samples.
falcon_web_child.cql: Falcon LogScale ProcessRollup2 hunt, not Cassandra CQL.
  Native field names checked against official Falcon integration documentation;
  extracted predicates tested offline. CQL parsing and tenant execution NOT run.
defender_web_descendant_context.kql / falcon_web_descendant_context.cql:
  Separate shell-descendant context, not direct-child replacements. Official field
  sources and modeled fixtures checked; no native parser or tenant execution.
splunk_web_child.spl: Splunk CIM Endpoint.Processes seven-day Linux process hunt.
  Official CIM fields and SPL syntax checked; extracted predicates and selected
  structure tested offline. Splunk engine and tenant execution NOT run.
sumologic_web_child.query: Sumo Logic query under the explicit JSON/source contract
  below; not a universal native schema query. Official syntax checked and extracted
  predicates/contract fixtures tested offline. Sumo engine/tenant execution NOT run.
php_request_exec_triage.yar: static PHP source-file lexical triage.
  The original packet records YARA 4.5.4 compilation and five inert fixture matches,
  plus the oversized-file exclusion, for this unchanged rule's SHA-256. The current
  independent review confirmed that identity and reran the lexical model; it did
  not rerun YARA. No corpus evaluation, efficacy measurement, or production scanning.
php_error_leakage.rules: Snort 3 HTTP error-leakage/context indicator, alert-only.
  Basic structure and body-string model checked offline; Snort parser and packet
  replay NOT run. Not a Snort 2 rule or a multipart exploit signature.
sophos_mapping_recipe.txt: deliberately non-executable source/schema mapping recipe.
  No authoritative complete Linux history schema verified; history SQL NOT supplied.
sophos_live_process_snapshot.sql: Sophos Live Discover Live Endpoint snapshot hunt.
  Official upstream osquery columns verified; actual SQL parsed/executed on an
  in-memory synthetic SQLite table. Sophos/osquery runtime and tenant NOT tested.
  Select Linux Live Endpoint, not Data Lake; confirm deployed schema before running.
fixtures/: synthetic JSON records and inert text, not malware or exploit samples.
test_detections.py: 11 standard-library offline test methods. Run
  python test_detections.py. Includes 30 process, 10 descendant, and 5 Sumo-contract
  fixture records, plus 617 generated accepted/rejected executable-name cases.

No platform tenant was accessed. Current-release offline tests were rerun against
these corrected files. Native YARA validation is a hash-matched source-packet
record; prior pySigma validation is stale for the changed Sigma rule. No Snort
parser was run. Native-library absence must not be presented as a parser pass.
Python regex modeling is not equivalent to Sigma backend, KQL, CQL, YARA, or Snort
engine verification. The standard-library test suite reads
the actual rule predicates rather than asserting a separately retyped utility list.

SOPHOS SNAPSHOT EXAMPLE
The SELECT-only SQL uses upstream osquery processes: pid, parent, name, path,
cmdline, uid, and start_time. Sophos's official query-editor documentation directs
Live Endpoint query authors to the osquery schema. Confirm those fields in the
deployed sensor before use; upstream verification is not tenant verification.
The query requires both child and parent still present, with positive start times
and a parent start no later than the child. It misses exited processes entirely.
Names may reflect argv[0] or paths and may be truncated; tune to actual endpoint
data. Exact names and bounded GLOB patterns implement the shared name contract
below, not a permissive php% prefix. Start-time checks reduce obvious PID-reuse
mistakes without making the snapshot atomic or proving lineage. No result does
not rule out earlier execution.

PROCESS HUNTS: TELEMETRY, TUNING, AND BLIND SPOTS
Provide process creation plus direct parent attribution on authorized Linux web
hosts. Enroll the web workload, not just its proxy. Nginx commonly delegates PHP
execution to FPM; the relevant process tree may belong to the FPM host/container.
Shared executable-name contract: php, php-fpm, and php-cgi; optional dotted M.m or
compact Mm version before or after -fpm/-cgi; frankenphp; lsphp with optional M.m
or Mm; apache2, httpd, and nginx. M is one digit 5-9, m is one digit 0-9. This
deliberately bounded classifier includes php7.4, php8.0-fpm, php-fpm81, and lsphp83;
it rejects phpunit and suffix extensions. It identifies names, NOT vulnerable
versions. Custom/renamed executables, major-only names, two-digit minor versions,
python3.12, and alternate runtimes miss. Confirm deployed basenames and adapt all
formats consistently. LiteSpeed documents a versioned directory whose executable
is simply lsphp; directory/package versions must not be confused with basenames.
Parent and child names are case-sensitive in the supplied predicates. Sigma uses
re for both paths because ordinary Sigma string selectors are case-insensitive.

Tier 1: *_web_child files select a chosen utility directly beneath a recognized
service. PHP -> sh -c already matches at shell creation. Tier 2: the two native
*_web_descendant_context files select a chosen utility beneath a selected shell
whose grandparent has a recognized service name. Native outputs label HuntTier
as direct_child or shell_descendant_context. The second tier requires Microsoft's
InitiatingProcessParentFileName or Falcon's GrandParentBaseFileName; official
schema/examples do not guarantee populated Linux data in any tenant. Validate a
known event first. This is two-generation name context, not an arbitrary ancestry
join, an exploit finding, or a validated risk ranking. Other formats remain
direct-parent hunts; no universal grandparent field is invented for them.

The child set intentionally includes shells, download/network tools, interpreters,
and basic discovery utilities. It can catch a selected utility executed directly
without a shell. In-process PHP/native operations that create no process are blind;
so are in-memory activity, missing events, unmonitored containers, and incomplete
parent attribution. Host instrumentation does not automatically establish container
visibility. Validate namespace/process mapping and collection before relying on it.

False positives include PHP CLI maintenance, application subprocesses, health
checks, exports, deployments, and authorized diagnostics. A configured local-mail
handoff can produce PHP -> sh -c -> sendmail; the shell matches even though
sendmail is not a selected child utility. Check the worker's effective sendmail_path,
approved mail wrapper, mail/application logs, account, and full command before
excluding a specific owned workflow. Never suppress every command containing
sendmail or every process under a web user. Image/video wrappers and deployment
hooks can similarly create shells; confirm the wrapper owner, approved path and
arguments, deployment history, and expected output/network activity. Investigate
new script paths, extra arguments, unexpected destinations, or changed wrappers.
Start as a hunt and baseline by application, service account, path, and command.
An unselected child such as an image converter is not evidence of benign behavior.

Defender: select authorized Linux devices and adjust the seven-day window to the
licensed retained history. DeviceProcessEvents is a Defender native table; it is
not guaranteed in every Sentinel workspace. Do not paste this into a nonexistent
generic ProcessEvents table. For Sentinel, first verify the connector/table or
map a supported ASIM process parser and its parent/name/time fields; no normalized
Sentinel execution is claimed here. Keep Timestamp, DeviceId, and ReportId for
investigation, and review custom-detection requirements before any promotion.

Falcon: use a repository containing native Falcon process events and scope the UI
time picker and host selection to authorized Linux servers. The documented tutorial
uses #event_simpleName because it is tagged. Other ingestion pipelines may rename
or omit the listed fields. Inspect actual events before adapting. The projection
uses aid as host identity; no lookup package or derived ComputerName is assumed.

SPLUNK CIM CONTRACT
This is runnable SPL for an accessible CIM Endpoint.Processes dataset, not arbitrary
raw Linux logs. Map complete executable paths to Processes.parent_process_path and
Processes.process_path, child command line to Processes.process, and host/user/PIDs
to the named CIM fields. Require Processes.os exactly Linux for this v1 selector;
verify your OS mapping. A missing/different OS value is a known coverage gap, not a
negative finding. Use search-role/index restrictions or an additional verified dest
restriction to select authorized Linux web workloads. Do not assume model access or
normalization exists just because process logs were ingested. Check a known event.

The file bounds the search to seven days and uses native rename, not ES macros.
summariesonly=false includes unsummarized data and can be slower; true would omit
unaccelerated/unsummarized data. Check permissions, retention, CIM mapping, summary
lag, and runtime cost. fillnull_value prevents unrelated missing group fields from
silently discarding rows, but a missing executable path still cannot match. Counts
are grouped process-event records per second and listed fields, not unique attacks.
Review duplicate sources. The direct-parent false positives/blind spots above apply.
Pivot to original endpoint/raw records for full command text and stable process
identity; the CIM process field has a 2048-character limit, and grouping can combine
otherwise identical records within one second.

SUMO LOGIC JSON/SOURCE CONTRACT
The file is a complete query for a deliberately named source category,
security/linux/process-json. This is a package-defined contract, NOT a vendor's
universal category or native field schema. Use it only if that category contains
authorized Linux PROCESS-CREATION events represented by one JSON object per message.
Required case-sensitive JSON keys: ParentImage and Image, both complete executable
paths. Optional CommandLine is retained if supplied. Collector/source metadata must
set the correct _sourceHost and event timestamp; choose Last 7 Days in the search UI.
The source category supplies Linux/event-type/host scope, not a path-string guess.
If your source differs, map it to this contract or deliberately adapt the source
selector and JSON keys, then verify a known event. Do not run an unmapped pipeline
and interpret an empty result as clean. Never relabel inventory snapshots as events.

The JSON operators use nodrop so missing optional command text does not hide a
match. The two following parse-regex operators intentionally drop records without
matching required parent/child paths; all inner groups are non-capturing. These
filters implement the direct-parent tier and shared executable-name contract above.
fixtures/sumo_process_events.json covers expected matches, wrong category, missing
parent, missing optional command line, and an unselected tool. Fixtures are a local
model of the declared contract, not evidence of a Sumo deployment or engine run.

YARA TRIAGE
Scan authorized file copies or an evidence image, not an uncontrolled upload.
The rule requires a PHP opening tag and a direct request-superglobal argument to
a selected command function in a file under 1 MiB. It performs no taint/data-flow
analysis. A comment or documentation can match; the positive fixture is deliberately
inert documentation. Legitimate diagnostic code can also match. Variable functions,
wrappers, encoded input, different execution APIs, short tags, larger files, and
memory-only operations can miss. Inspect ownership, provenance, changes, and actual
code flow before containment. Never auto-delete or execute a file because it matches.

SNORT HTTP ERROR-LEAKAGE / CONTEXT INDICATOR
Scope HOME_NET to the authorized servers and allocate an unused local SID before
loading. HTTP in the rule header requires the detected service to match while
retaining the network/port/direction constraints. The service:http option in a TCP
header is not an equivalent strict filter because its service and ports use OR
semantics. HTTP inspection must expose normalized response bodies through file_data.
Use an approved cleartext segment after TLS termination or another authorized
visibility mechanism; encrypted bodies cannot be inspected by this string rule.
HTTP/2 or other protocol support, decompression, stream reassembly, and body/depth
limits depend on the deployed inspector and configuration. Verify them explicitly.

The two strings indicate PHP-style memory-exhaustion text returned to a client.
Normal application defects, load spikes, synthetic examples, and documentation
can match. Matching text does not prove display_errors is enabled on a PHP worker.
A reverse proxy may generate its own error, suppress the body, or send
logs elsewhere. Correct production error suppression also means no match. This is
neither a request-payload detector nor a count of compromised servers. Investigate
server logs even when public error output is disabled; do not enable display_errors
to make this rule fire. PHP recommends error logging instead of public error display.

TRIAGE SEQUENCE
1. Confirm runtime version/backport and the worker's actual loaded package.
2. Preserve original events, clock context, request IDs, worker/process identity,
   app deployment history, relevant files, and logs using approved handling.
3. Correlate process activity with web/error logs, request volume/size, worker
   restarts, file changes, and outbound connections. Error bursts are leads only.
4. Separate approved application subprocesses from unexpected execution. A process
   after an error is temporal correlation, not exploit attribution. A stale-state
   case can span requests; adjacent access-log lines do not establish same-worker
   consumption. Absence of a dropped file or shell does not exclude compromise.
5. Escalate confirmed unexpected behavior under the incident-response process.
   These files do not authorize live testing, production changes, or blocking.

PRIMARY SOURCES OPENED AND CHECKED ON 2026-10-21
PHP OOM advisory:
https://github.com/php/php-src/security/advisories/GHSA-w8hw-w9fx-j79w
PHP stale-global-state advisory:
https://github.com/php/php-src/security/advisories/GHSA-6wmf-4rv5-p3rp
Microsoft native table/field schema:
https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-deviceprocessevents-table
Falcon native event/field/query examples:
https://library.humio.com/integrations/integrations-crowdstrike-fltr-tutorial-crowdstrike-fltr-tutorial.html
https://library.humio.com/integrations/integrations-crowdstrike-fltr-core-crowdstrike-fltr-core.html
Falcon grandparent field in a CrowdStrike-owned query and field assignment:
https://github.com/CrowdStrike/logscale-community-content/blob/main/Queries-Only/Helpful-CQL-Queries/Two%20whoami%20Commands%20Run.md
https://library.humio.com/crowdstrike-query-language/syntax-fields.html
Microsoft output classification syntax:
https://learn.microsoft.com/en-us/kusto/query/extend-operator
Runtime executable examples:
https://frankenphp.dev/docs/
https://docs.litespeedtech.com/lsws/extapp/php/getting_started/
PHP configured mail handoff and shell-free proc_open arrays:
https://www.php.net/manual/en/mail.configuration.php
https://www.php.net/manual/en/function.proc-open.php
Sigma rule specification and process taxonomy:
https://sigmahq.io/sigma-specification/specification/sigma-rules-specification.html
https://sigmahq.io/sigma-specification/specification/sigma-appendix-taxonomy.html
YARA grammar:
https://yara.readthedocs.io/en/stable/writingrules.html
Snort 3 normalized response body, service, and flow:
https://docs.snort.org/rules/headers/protocols
https://docs.snort.org/rules/options/payload/file_data
https://docs.snort.org/rules/options/general/service
https://docs.snort.org/rules/options/non_payload/flow
Sophos source choice and schema requirements:
https://docs.sophos.com/central/customer/help/en-us/ManageYourProducts/ThreatAnalysisCenter/LiveDiscover/EditOrCreateQuery/index.html
Official osquery snapshot schema and SQL behavior:
https://github.com/osquery/osquery/blob/master/specs/processes.table
https://github.com/osquery/osquery/blob/master/docs/wiki/introduction/sql.md
SQLite GLOB semantics:
https://www.sqlite.org/lang_expr.html
PHP production error handling:
https://www.php.net/manual/en/errorfunc.configuration.php
Splunk CIM Endpoint.Processes, tstats, and native rename:
https://help.splunk.com/en/splunk-enterprise/common-information-model/6.4/data-models/endpoint
https://help.splunk.com/en/splunk-enterprise/search/spl-search-reference/10.0/search-commands/tstats
https://help.splunk.com/en/splunk-enterprise/search/spl-search-reference/10.0/search-commands/rename
Sumo Logic JSON aliases/nodrop, parse-regex fields, and projection:
https://www.sumologic.com/help/docs/search/search-query-language/parse-operators/parse-json-formatted-logs/
https://www.sumologic.com/help/docs/search/search-query-language/parse-operators/parse-variable-patterns-using-regex/
https://www.sumologic.com/help/docs/search/search-query-language/search-operators/fields/
