PHP2Shell research detection appendix | Deception Check | 2026-10-23

Start with the shared download address and vector-bearing command lines, then
check HTTP labels, child processes, and worker failures. These experimental
hunts locate investigation leads; they do not establish that either PHP2Shell
CVE triggered. Test and tune locally before configuring alerts or prevention.

SHARED DESTINATION AND COMMAND CONTEXT
splunk-shared-loader-outbound.spl uses CIM Network Traffic tags and exact dest_ip
217.60.102.5. It keeps events with missing direction. The optional direction
filter is commented out; confirm direction relative to your reporting device
before enabling it. Inbound, internal, or unknown-direction rows can also match.
Missing CIM tags or dest_ip extraction still excludes events. Preserve action
to distinguish blocked attempts from allowed traffic. No port or protocol is
assumed. The address was a download destination in submitted command text,
not a verified C2 endpoint; address reuse and authorized testing can match.
defender-shared-loader-network.kql searches DeviceNetworkEvents by exact
RemoteIP and returns initiating process, parent, and command context. It keeps
all ActionType values: inspect your portal schema for direction and outcome.
An inbound or failed event may match; a row does not prove download or execution.
Proxy/NAT behavior, address changes, retention, and absent telemetry limit both.

sigma-linux-loader-pipe-vector.yml finds curl or wget piped to sh -s with an
apache, ssh, telnet, or php2shell argument, OR scp referencing dlr@HOST:sh.
The SCP branch matches the account and remote basename, not transfer direction
or outcome; uploads using that remote operand can also match.
The host is unrestricted. Authorized SCP transfers using those names can match.
The pipeline branch accepts paths and optional -- before its vector argument.
Search the complete shell command line; a downloader's
own child event may omit the pipeline. The destination is unrestricted so
changed infrastructure can match. This is text matching, not a shell parser:
quoted examples and authorized installers can match, while alternate shells,
encoding, renamed tools, changed flags, or truncated events can evade it.
The narrow SCP branch can miss other users, remote paths, URI syntax, and IPv6.
Correlate destination, process ancestry, request context, and event timing.

HTTP INPUT
sigma-web-php2shell-label.yml maps the parsed incoming User-Agent to cs-user-agent.
It matches the case-insensitive substring php2shell, covering the three observed
labels. It misses the later downloader request, which had no user agent.
splunk-web-php2shell-label.spl uses Splunk CIM Web tags and http_user_agent.
sumo-web-php2shell-label.sumo uses Sumo's documented public/apache/access parser.
Adapt its example source selectors to your Apache combined-access source; use
the time picker. A missing or failed parser is a coverage gap, not a clean result.
Ordinary access logs generally do not contain request bodies.
sigma-web-libredtail-user-agent.yml separately matches libredtail-http in the
same parsed User-Agent field. That label appeared in the linked HTTP traversal
requests; it was absent from the later PHP-tagged downloader. It is caller
supplied, and neither a match nor a vector argument identifies a malware family.

RUNTIME
sigma-linux-php-worker-child.yml, defender-php-worker-child.kql, and
falcon-php-worker-child.logscale find direct shell/downloader children of
php-fpm/php-cgi, including numeric version suffixes. Baseline authorized tasks.
Defender uses DeviceInfo to scope Linux and DeviceProcessEvents for actual
process creation; stale or absent DeviceInfo can exclude hosts. Falcon expects
ProcessRollup2 in a repository retaining native Falcon fields; use the time
picker and inspect result limits. Splunk's companion uses CIM Endpoint.Processes
tags and full paths. Verify and apply your deployment's Linux os values or
restrict to a known Linux process source; the provided query does not apply an
OS filter. The path test can also match other Unix hosts. Add index/sourcetype
scoping for performance after verifying local mapping.
These hand-written translations are not a claim of automatic Sigma conversion.
Missing parents, wrappers, renamed executables, busybox applets, grandchildren,
Apache mod_php (covered separately by sigma-linux-apache-child.yml), PHP CLI,
and execution without these child tools can evade them.
PHP workers may legitimately invoke shells or downloaders. Correlate the process
with the request and actual file/network evidence before reaching a verdict.
sigma-linux-apache-child.yml adds a separate, low-severity hunt for direct
shell/downloader children of apache2 or httpd. Confirm mod_php through inventory;
the parent name alone does not show which module is loaded. CGI, application
subprocesses, piped log helpers, and maintenance make this noisy. It shares the
PHP-worker rule's ancestry, renamed-tool, busybox, and grandchild blind spots.

WORKER FAILURES
splunk-php-worker-errors.spl classifies PHP memory-limit errors, allocator
"Out of memory (allocated N)" messages, with optional "bytes", execution timeouts,
FPM signal-11 or code-255 exits, and Apache child segmentation faults. Code 255
is a generic exit status; it does not identify OOM, request-startup failure, or
exploitation by itself. PHP 7.4.33 source omits "bytes" after the allocated size;
PHP 8.4.26 includes it. Both forms are covered. Bare OOM and newer hard-limit formats
are outside this narrow pattern. The two added message patterns were checked
against PHP source and synthetic fixtures, not observed runtime logs from this
research. Validate them against your own known-good and failure logs. Adapt the
example source globs to verified PHP/FPM/Apache logs, including journald or
container sources where needed. It groups messages into five-minute bins by
host and source and sorts counts; there is no universal alert threshold. Review
the raw events behind an unusual bin, service baseline, nearby requests, and
runtime evidence. Benign application bugs, extension faults, load, and duplicate
forwarding can produce bursts. Counts are messages, not distinct worker crashes.
Missing, truncated, differently formatted, or disabled logs limit coverage.
Kernel OOM-killer records are outside this query. Error bursts are symptoms to
investigate, not a CVE signature or evidence that exploitation succeeded.

OFFLINE YARA
php2shell-offline-triage.yar has three deliberately different roles:
1. Text_Label: weak keyword correlation. A research document also matches.
2. Upload_Progress_PHP_Function_Tokens: stronger co-occurrence of the progress
   marker, PHP opening tag, and a command-function token. It does not parse PHP
   or bind the code to a particular multipart field. Source uploads, examples,
   and training data can match. Decode into one request/body per file where
   authorized; concatenated logs can combine unrelated tokens. Both text rules
   cap input at 2 MiB and do not decode JSON escapes, HTML entities, or archives.
3. Known_Repetitive_Upload_Artifact: exact size/SHA-256 correlation of the two
   verified filler uploads. This does not classify them as malware or establish
   whether their original surrounding requests were safe. No generic A/B/C run
   is treated as a malicious signature.

SNORT 3
php2shell-snort3.rules uses HTTP sticky buffers. SID 1000618 is the weak UA hunt.
SID 1000619 requires multipart Content-Type plus progress/PHP/function tokens
in the request body. It checks co-occurrence, not full multipart semantics.
HTTPS must already be visible through authorized TLS termination/decryption;
deploying a rule beside encrypted traffic does not create visibility. Confirm
HTTP inspection, body depth, stream handling, $HOME_NET, and SID availability.
These use Snort 3 HTTP sticky-buffer syntax, not Snort 2 or Suricata syntax.

VALIDATION AND NEXT STEP
YARA compiled and matched inert positive/negative fixtures using yara-python
4.5.4. All five Sigma rules parsed using pySigma 2.0.1; local predicate fixtures were
also checked. The fixtures contain no executable exploit and contact no endpoint.
Sigma backend conversion/deployment, Snort 3 compilation/replay, and Defender,
Splunk, Falcon, and Sumo tenant execution were NOT PERFORMED. Their syntax and
field assumptions were reviewed against official documentation. Local predicate
tests do not replace those engines. Supplemental network and error-pattern
tests check predicates only; they do not test platform extraction, source
selection, time filtering, network outcomes, binning, or aggregation. Read
fixtures.json and supplemental-fixtures.json, then run validate.py in a local
Python environment with yara-python, pysigma, and PyYAML installed.

Before operational use, validate your local fields, run benign uploads and known
authorized process tasks, inspect which positives remain, and record the blind
spots. Keep request receipt, generated decoy responses, and real runtime events
as separate evidence. This pack is intended for investigation, not auto-blocking.
