Project

General

Profile

Actions

Security #9157

closed
PA PA

mime: RFC 2231 `filename*` evades Suricata `file.name` inspection (http1, smtp)

Security #9157: mime: RFC 2231 `filename*` evades Suricata `file.name` inspection (http1, smtp)

Added by Philippe Antoine about 2 months ago. Updated 7 days ago.

Status:
Closed
Priority:
Normal
Target version:
Affected Versions:
Label:
CVE:
Git IDs:

164b57effc60d6fba1bb43aff880dc0b248c5ea8
26605b7a66afbddd92647b7cd9e26c6c0a795a52
94d512cffe3ce0600c6d6bd4d2d7576a08432194

Severity:
LOW
Disclosure Date:
01/02/2027

Description

Original report

Hello OISF Security Team,
I found a multipart parsing differential affecting Suricata 8.0.6.
Summary
Suricata extracts a file from an HTTP multipart/form-data request when a part has a literal filename parameter. Its MIME token parser does not recognize a bare RFC 2231 extended filename* parameter. When both parameters are present, Suricata uses the plain value; when only filename* is present, Suricata does not expose a filename through file.name.
Werkzeug accepts the same extended parameter and selects its decoded value for the application. One request can therefore present safe.png or no filename to Suricata while presenting shell.php or .htaccess to the protected application.
The attached offline PCAP uses Suricata file.name rules to alert on these dangerous names. Ordinary filename="shell.php" and filename=".htaccess" controls generate alerts, proving that filename inspection is active. Equivalent filename* requests do not alert, although the origin selects the dangerous filename.
A separate HTTP-method signature alerts on all seven flows, ruling out missing or malformed PCAP traffic.
ALERT     filename="shell.php"                                      origin: shell.php
NO ALERT  filename="safe.png"; filename*=UTF-8''shell.php           origin: shell.php
NO ALERT  filename*=UTF-8''shell.php                                origin: shell.php
Steps to reproduce
Install Docker and Python 3 with Scapy, then open the report bundle’s repository root.
Run the isolated test:
testing/suricata/run.sh
Open testing/suricata/artifacts/results.json. The plain_php control shows that the origin selected shell.php and Suricata raised filename signature 1000001.
Compare it with paired_utf8_php. The origin again selects shell.php, and the signature 1000000 confirms that Suricata parsed the HTTP request, but no dangerous-filename alert is raised. This missing file.name alert demonstrates the bypass.
Tested image:
jasonish/suricata:8.0.6
sha256:aa01a4639c21549dceca718d3d7b1429e888e7547cc8c54215dacd3b33fcfd35
The complete report, PCAP, detection rules, scripts, and generated results are attached.
SHA-256:
3acbb1741c580397a30fbbe4e8a2c6c11448a60de612037aedd98249dbb05f48

LOW severity as limited scope evasion

GitHub ID for credit: 0xkalawy


Subtasks 1 (0 open — 1 closed)

Security #9158: mime: RFC 2231 `filename*` evades Suricata `file.name` inspection (http1, smtp) (8.0.x backport)ClosedPhilippe AntoineActions

Related issues 2 (2 open — 0 closed)

Related to Suricata - Task #9206: tracking: mime: better handle duplicate tokens TriagedOISF DevActions
Related to Suricata - Feature #9176: http2: support multipart/form-dataAssignedPhilippe AntoineActions
Actions

Also available in: PDF Atom