Analytics Story: PHP2Shell

Description

This analytic story covers exploitation attempts and post-exploitation activity associated with PHP2Shell (CVE-2026-109618 and CVE-2026-109619). Its detections identify suspicious multipart upload and PHP session upload-progress patterns, large POST requests that receive HTTP 500 responses, PHP memory exhaustion correlated with web requests, and endpoint process activity that may follow successful exploitation.

Why it matters

PHP2Shell is associated with remote code execution vulnerabilities in PHP session upload-progress and multipart request handling. The web detections in this story look for related request patterns: a PHP_SESSION_UPLOAD_PROGRESS field accompanied by a serialized PHP structure in an upload filename, a PHPSESSID field accompanied by a PHP opening tag in an upload filename, and large POST request bodies that receive HTTP 500 responses. Another detection correlates multipart access events with PHP memory exhaustion errors in Apache or Nginx logs.

These web indicators identify suspicious activity for investigation; any one result alone does not confirm successful exploitation. Review the full request headers, filenames, source and destination addresses, URI, response status, and PHP error details. Correlate access and error records by host, client, and PID, and consider request identifiers where the logs provide them.

Endpoint detections add post-exploitation coverage by identifying inline PHP interpreter execution, web or application servers spawning shells, and suspicious child processes spawned from Windows web servers. Review process ancestry, command lines, users, network activity, and timing alongside the web events. Validate the affected PHP version and configuration, including upload-progress and session handling settings, and tune for approved large uploads or development activity.

Web Anomaly Followed by Server Process Execution

 1| tstats `security_content_summariesonly`
 2    min(_time) as firstTime
 3    max(_time) as lastTime
 4from datamodel=Risk.All_Risk where
 5
 6All_Risk.risk_object_type="system"
 7
 8source IN (
 9    "*PHP Serialized Object in POST Body*",
10    "*PHP SOAP DTD Entity Reference in Attribute*",
11    "*PHP SOAP Malformed Array Dimensions*",
12    "*HTTP Large POST and Oversized Multipart Header Activity*",
13    "*Ruby Repeated Legacy Sharp S Bytes in POST Body*",
14    "*PostScript or EPS Upload with Image or PDF Extension*",
15    "*Large HTTP POST Request Resulting in Server Error*",
16    "*Zeek HTTP Malformed Base64 Padding*",
17    "*Windows Suspicious Child Process Spawned From WebServer*",
18    "*Web or Application Server Spawning a Shell*",
19    "*Linux Auditd Shell from Web or Application Directory*",
20    "*Inline PHP Code Execution*"
21)
22
23by All_Risk.normalized_risk_object source _time span=1s
24
25| `drop_dm_object_name(All_Risk)`
26
27| where isnotnull(normalized_risk_object)
28
29| lookup asset_lookup_by_str asset as normalized_risk_object OUTPUT ip as asset_ip
30
31| eval normalized_risk_object=coalesce(asset_ip,normalized_risk_object)
32
33| fields - asset_ip
34
35| eval web_request=if(in(source,
36      "ESCU - PHP Serialized Object in POST Body - Rule",
37      "ESCU - PHP SOAP DTD Entity Reference in Attribute - Rule",
38      "ESCU - PHP SOAP Malformed Array Dimensions - Rule",
39      "ESCU - HTTP Large POST and Oversized Multipart Header Activity - Rule",
40      "ESCU - Ruby Repeated Legacy Sharp S Bytes in POST Body - Rule",
41      "ESCU - Large HTTP POST Request Resulting in Server Error - Rule",
42      "ESCU - Zeek HTTP Malformed Base64 Padding - Rule",
43      "ESCU - PostScript or EPS Upload with Image or PDF Extension - Rule"),1,0),
44       web_time=if(web_request=1,firstTime,null()),
45       web_source=if(web_request=1,source,null())
46
47| sort 0 normalized_risk_object firstTime -web_request
48
49| streamstats max(web_time) as preceding_web_time
50              last(web_source) as web_analytic
51              by normalized_risk_object
52
53| where web_request=0
54    AND isnotnull(preceding_web_time)
55    AND firstTime>=preceding_web_time
56    AND firstTime-preceding_web_time<=900
57
58| eval endpoint_analytic=source,
59       time_delta_seconds=firstTime-preceding_web_time,
60       risk_object=normalized_risk_object,
61       lastTime=firstTime,
62       firstTime=preceding_web_time
63
64| fields risk_object web_analytic endpoint_analytic time_delta_seconds firstTime lastTime
65
66| `security_content_ctime(firstTime)`
67| `security_content_ctime(lastTime)`
68| `web_anomaly_followed_by_server_process_execution_filter`

Detections

Name ▲▼ Technique ▲▼ Type ▲▼
PHP Worker Segmentation Fault After Multipart POST Exploit Public-Facing Application Anomaly
Cisco Secure Firewall - PHP2Shell Suspicious Upload Activity Exploit Public-Facing Application TTP
Windows Suspicious Child Process Spawned From WebServer Web Shell Anomaly
PHP Opening Tag in Upload Filename - Suricata Exploit Public-Facing Application Anomaly
Cisco Secure Firewall - PHP2Shell Serialized Payload Activity Exploit Public-Facing Application TTP
Large HTTP POST Request Failure or Missing Response - Suricata Exploit Public-Facing Application Anomaly
PHP Memory Exhaustion Exploitation Attempt via Multipart Request Exploit Public-Facing Application Anomaly
Cisco Secure Firewall - PHP2Shell Exploitation Attempt Exploit Public-Facing Application TTP
Linux Auditd Web or Application Server Spawning a Shell Exploit Public-Facing Application TTP
Large HTTP POST Request Resulting in Server Error Exploit Public-Facing Application Anomaly
PHP Session Upload Progress Serialized Payload in Upload Filename Exploit Public-Facing Application Anomaly
PHP Session Upload Progress with PHP Code in Upload Filename Exploit Public-Facing Application Anomaly
Web or Application Server Spawning a Shell External Remote Services, Exploit Public-Facing Application TTP
Linux Auditd Inline PHP Code Execution Command and Scripting Interpreter Anomaly
Linux Auditd Service Crash and Restart Burst Application or System Exploitation Anomaly
Serialized PHP Token in Upload Filename - Suricata Exploit Public-Facing Application Anomaly
Inline PHP Code Execution Command and Scripting Interpreter Anomaly

Data Sources

Name ▲▼ Platform ▲▼ Sourcetype ▲▼ Source ▲▼
Apache Error Log Web apache:error /var/log/apache2/error.log
Apache Access Log Web apache:access:combined /var/log/apache2/access.log
Cisco Secure Firewall Threat Defense Intrusion Event Network icon Network cisco:sfw:estreamer not_applicable
CrowdStrike ProcessRollup2 Other crowdstrike:events:sensor crowdstrike
Sysmon EventID 1 Windows icon Windows XmlWinEventLog XmlWinEventLog:Microsoft-Windows-Sysmon/Operational
Windows Event Log Security 4688 Windows icon Windows XmlWinEventLog XmlWinEventLog:Security
Suricata Network icon Network suricata not_applicable
Nginx Access Web nginx:plus:kv /var/log/nginx/access.log
Nginx Error Log Web nginx:plus:error /var/log/nginx/error.log
Linux Auditd Syscall Linux icon Linux auditd auditd
Zeek HTTP Web zeek:http http.log
Sysmon for Linux EventID 1 Linux icon Linux sysmon:linux Syslog:Linux-Sysmon/Operational
Linux Auditd Execve Linux icon Linux auditd auditd

References


Source: GitHub | Version: 2