Hunt: the four-request PHP2Shell chain that actually got shells, with header order, body hashes, source IPs and the Apache-to-/bin/sh signal
Based on the Oct 24 packet-to-process report. Success criterion: a shell started by the web server, not an HTTP status code.
- Process (strongest):
/bin/sh(thenid,curl,wgetorphp) whose parent isapache2/httpdrunning as the web user, followed within about a second byAH00052 ... Segmentation fault (11)for the same worker PID. - Request burst from one source within a few seconds: (A1) a chunked multipart POST to
/?q..=vwith five numbered query parameters, about 1 MB, mostlyfiles*fields; (B1) a chunked multipart POST to/of about 33 MB with roughly 900x*fields; (A2) a fixed-length POST of about 280 KB; (B2) a fixed-length POST of about 450 KB with ~500s*and ~495t*fields. All carryPHPSESSIDandPHP_SESSION_UPLOAD_PROGRESS. - Headers: no
User-Agent; a ten-characterCmultipart boundary; header orderHost, Content-Type, Transfer-Encoding, Connection(chunked) orHost, Content-Type, Content-Length, Connection. - Responses: a
Set-Cookie: PHPSESSIDthat decodes to 819,200 bytes is the memory leak. Alert on anySet-Cookielarger than a few KB. - PHP error log:
Allowed memory size of ... exhausted ... in Unknown on line 0right before and after the leak request. - Decoded-body SHA-256 (template, not proof of success): A1
8e8fc166e6b326d20bb7611d8ef3cee3bd5da46447985312c1492ab0a44d1eb6, B1b6c547e0e9a2bb26607df1521de96f4d5c9adf4621c28b7ab491587b21ae40f2, A27af66c8f35c5fa6b47a539da6dca361d19543d9f62d61e4af891c2802bd5e236. These hash the decoded multipart body, not the wire bytes. - IPs (Oct 24; hosting providers, short-lived):
15.204.59.70,162.35.99.94confirmed shells;104.28.208.84and144.48.4.242sent attempts only. Treat a hit as a lead.
// Sketch: web server spawning a shell (Defender for Endpoint / Sysmon-style)
DeviceProcessEvents
| where InitiatingProcessFileName in~ ("apache2","httpd","php-fpm","php-cgi")
| where FileName in~ ("sh","bash","dash")
| project Timestamp, DeviceName, InitiatingProcessFileName, ProcessCommandLineSources: Adel Karimi (0x4D31): PHP2Shell exploitation observed, packet-to-process RCE evidence (Oct 24) · Datadog Security Labs: PHP2Shell detection, analysis and remediation