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.

Raw source PHP Opening Tag in Upload Filename - Suricata · SPL
Esc
Published by splunk/security_content ↗, licensed under Apache 2.0 ↗. Reproduced here unmodified.
name: PHP Opening Tag in Upload Filename - Suricata
id: 79fe02c5-5ccd-4119-9d94-c3f8418fae2a
version: 1
creation_date: '2026-10-23'
modification_date: '2026-10-28'
author: Raven Tait, Onur Mustafa Erdogan, Nasreddine Bencherchali, Splunk
status: production
type: Anomaly
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.
data_source:
    - Suricata
search: |-
    `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`
how_to_implement: |-
    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.
references:
    - https://www.php2shell.com/
    - https://github.com/php/php-src/commit/3584a98bda0f2c0d367255b046798b0d3a221a19
    - https://docs.suricata.io/en/latest/output/eve/eve-json-output.html
intermediate_findings:
    entities:
        - field: dest
          type: system
          score: 40
          message: A POST request from [$src$] to [$dest$] included a PHP opening tag in an upload filename.
threat_objects:
    - field: src
      type: ip_address
analytic_story:
    - PHP2Shell
asset_type: Web Application
cve:
    - CVE-2026-109618
    - CVE-2026-109619
mitre_attack_id:
    - T1190
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: web
security_domain: network
tests:
    - name: True Positive Test
      attack_data:
        - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/emerging_threats/php2shell/suricata.log
          source: not_applicable
          sourcetype: suricata
      test_type: unit

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.