Suricata rules + CI-proven regression suite for the php2shell PHP RCE chain (CVE-2026-109619 / CVE-2026-109618)
Suricata signature set for detecting php2shell — the unauthenticated PHP
RCE chain targeting session.upload_progress (CVE-2026-109619 /
CVE-2026-109618, CVSS 9.2) — shipped with a reproducible test harness that
proves detection coverage and false-positive behavior on every commit.
Every signature is derived from the toolkit's own request/response builders
(lib/chain.py, lib/oomprobe.py, lib/memprobe.py, lib/detect.py) —
auditable, versioned against an upstream pin, and regression-tested in CI
against byte-exact exploit traffic and the real CLI end-to-end.
Scope. This is defensive tooling (blue/purple team). The harness only ever talks to a local mock target. Pointing
php2shellat systems you do not own or lack written authorization for is a crime (CFAA, UU ITE, etc.).
| Tier | SIDs | What it catches |
|---|---|---|
| A — exploit chain | 1100001–1100006 | the full 3-stage RCE chain: heap-groom requests, forged-boundary multiparts, leaked PHPSESSID heap pointers in responses |
| B — active scanner | 1100007–1100010 | detect/preflight probes: nested-62 array keys, tool boundaries, transport quirks |
| C — target state | 1100012–1100014 | vulnerable-server responses: OOM-fatal inside the multipart parser, worker-abort correlation, probe field-pairing |
Validated matrix (Suricata 7.0.10, CI-asserted):
attack.pcap (11 streams, full chain) -> 28 alerts, 13/13 alert rules
attack-real (real CLI, 32 conns) -> 63 alerts, 13/13 alert rules
benign.pcap (FP regression set) -> 0 alerts
| SID | Signal | Hits (synthetic / real CLI) |
|---|---|---|
| 1100001 | chain groom request — boundary S×17 | 3 / 6 |
| 1100002 | chain forge request — boundary B×10 + PHPSESSID form-data | 3 / 7 |
| 1100003 | worker-rotate request — boundary BNDRY12345 | 1 / 3 |
| 1100004 | heap-leak response — Set-Cookie: PHPSESSID= ≥990B | 2 / 1 |
| 1100005 | leaked cookie carrying %7F-encoded pointer (libphp-base leak) | 2 / 2 |
| 1100006 | oversized multipart (>10MB) + upload_progress (flowbit pair) | 1 / 4 |
| 1100007 | nested-62 array key a[b][b]… (active OOM scanner) | 2 / 6 |
| 1100008 | detect probe — boundary ----php2shellprobe | 1 / 3 |
| 1100009 | memory_limit probe — P2SMEMPROBE / p2smem | 1 / 1 |
| 1100010 | quoted single-char boundary (boundary="x") | 2 / 6 |
| 1100012 | OOM fatal inside the multipart parser (Unknown location)¹ | 1 / 1 |
| 1100013 | worker-abort 5xx differential (xbits correlation) | 4 / 10 |
| 1100014 | PHP_SESSION_UPLOAD_PROGRESS + PHPSESSID form-field pairing | 5 / 13 |
| 1100015 | flowbit setter p2s_bigpost (state only, no alert) | – / – |
¹ threshold limit 1/60s by_dst — a 3-probe scanner burst yields one alert.
Counts are from the CI-validated baseline (Suricata 7.0.10). Synthetic-pcap counts are deterministic; real-CLI counts vary by ±1–2 per run (the toolkit jitters timing and retries stages) — the CI suite asserts minimums, not exact equality.
False-positive guards. The benign regression set (normal browser uploads
using the legitimate session.upload_progress feature, normal PHPSESSID
cookies, application-level OOM fatals with real file paths, 11MB uploads
without upload-progress) produces zero alerts. Discriminators are
documented per-SID in docs/SIGNALS.md.
Every rule carries native mitre_attack_phase metadata (ET-Open convention),
so SIEM/EDR correlation engines can consume the mappings directly:
| Tier | Techniques |
|---|---|
| A — exploit chain (1100001–1100006) | T1190 Exploit Public-Facing Application; T1059.004 Unix Shell on the forge requests (stage-3 carries the system() payload) |
| B — active scanner (1100007–1100010, 1100014) | T1595.002 Vulnerability Scanning |
| C — target state (1100012–1100013) | T1190 (server-side evidence of exploitation) |
Per-SID mappings are in the SID registry.
┌───────────────────────────────────────────────────────────────────────┐
│ synthetic suite │
│ │
│ lib.chain / lib.oomprobe (upstream, pinned commit) │
│ │ byte-exact request builders │
│ ▼ │
│ gen_traffic.py ──► attack.pcap ──┐ benign.pcap ──┐ │
│ ▼ ▼ │
│ suricata -r (offline, 7.0.10) │
│ │ │ │
│ ▼ ▼ │
│ assert 13/13 SIDs assert 0 alerts │
└───────────────────────────────────────────────────────────────────────┘
┌───────────────────────────────────────────────────────────────────────┐
│ real-tool end-to-end │
│ │
│ php2shell CLI (detect → preflight → exploit) │
│ │ plain HTTP, wire-exact │
│ ▼ │
│ mock_target.py (vulnerable-state replica: OOM-fatal parser, │
│ heap-leak cookies, proof channel) │
│ ▼ │
│ tee_proxy.py ──► recorded wire bytes ──► attack-real.pcap ──► │
│ suricata -r ──► assert every alert SID ≥ 1 │
└───────────────────────────────────────────────────────────────────────┘
The synthetic path guarantees byte-identical traffic (it imports the
upstream builders); the real-tool path proves the whole pipeline against the
actual CLI — including retry loops, jittered timing, and the final
PROOF: uid=33(www-data) in the mock.
Requirements: python3 (≥3.10), git, Suricata ≥ 7.0.10.
# 1) fetch the upstream reference (read-only consumer, used to build pcaps)
git clone --depth 1 https://github.com/aarsaputra/php2shell.git /tmp/php2shell
# 2) synthetic + benign regression (fast, ~30s)
P2S_REPO=/tmp/php2shell python3 lab/test_matrix.py --skip-real
# 3) full suite incl. the real CLI end-to-end
python3 -m venv /tmp/php2shell/.venv
/tmp/php2shell/.venv/bin/pip install -r /tmp/php2shell/requirements.txt
P2S_REPO=/tmp/php2shell python3 lab/test_matrix.py
Expected:
[attack] alerts-by-sid: {1100001: 3, 1100002: 3, ...} total: 28
[benign] alerts-by-sid: {} total: 0
[PASS] test_matrix: attack coverage complete, benign clean, real-tool end-to-end ok
Environment knobs: SURICATA_BIN, SURICATA_CONF, P2S_REPO, P2S_PY,
OUT_DIR — see the headers of the lab/ scripts.
Install the rules and apply the mandatory libhtp tuning: