PHP Opening Tag in Upload Filename - Suricata
Description
This analytic detects Suricata multipart POST events with an uploaded filename containing a PHP opening tag. Suricata EVE HTTP events do not expose multipart form field names, so this variant cannot confirm the PHPSESSID or PHP_SESSION_UPLOAD_PROGRESS fields without additional request-body inspection. The filename pattern may indicate an attempt to place executable PHP content into session-related data as part of PHP2Shell exploitation.
Query · spl
`suricata`
http_method=POST
fileinfo.filename=*
| rex field=fileinfo.filename max_match=0 "(?i)(?<php_token>(?:<\\?php\\b|<\\?=))"
| where isnotnull(php_token)
| rename dest_ip as dest,
src_ip as src
| stats count min(_time) as firstTime
max(_time) as lastTime
values(php_token) as php_token
values(http_content_type) as http_content_type
by fileinfo.filename
src src_port
dest dest_port
url http_method
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `php_opening_tag_in_upload_filename___suricata_filter`
Implementation guide
Configure Suricata EVE JSON to emit HTTP and fileinfo events, and ingest the JSON with the Splunk TA for
Suricata. Set the suricata macro to the TA's sourcetype (commonly sourcetype=suricata). Verify that
POST file events expose http_method, fileinfo.filename, src_ip, src_port, dest_ip, dest_port,
and the HTTP URL/content type fields used by the search. This rule matches PHP opening tags in the
filename only; Suricata EVE does not provide the multipart form field names needed to verify PHPSESSID or
PHP_SESSION_UPLOAD_PROGRESS.
Known false positives
- Security testing tools or development environments may upload files with PHP code in the filename. Review the request headers, destination application, and any follow-on requests or server-side execution evidence.
Analyst notes
Known false positives: Security testing tools or development environments may upload files with PHP code in the filename. Review the request headers, destination application, and any follow-on requests or server-side execution evidence.