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)
Affected Versions:
Label:
CVE:
Git IDs:
164b57effc60d6fba1bb43aff880dc0b248c5ea8
26605b7a66afbddd92647b7cd9e26c6c0a795a52
94d512cffe3ce0600c6d6bd4d2d7576a08432194
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
OT Updated by OISF Ticketbot about 2 months ago
- Subtask #9158 added
OT Updated by OISF Ticketbot about 2 months ago
- Label deleted (
Needs backport to 8.0)
JI Updated by Jason Ish about 2 months ago
- Description updated (diff)
PA Updated by Philippe Antoine about 2 months ago
- Status changed from Assigned to In Review
Gitlab MR
JI Updated by Jason Ish about 1 month ago
- Subject changed from http1: RFC 2231 `filename*` evades Suricata `file.name` inspection to mime: RFC 2231 `filename*` evades Suricata `file.name` inspection (http1, smtp)
@Philippe Antoine New title OK?
PA Updated by Philippe Antoine about 1 month ago
- Related to Task #9206: tracking: mime: better handle duplicate tokens added
PA Updated by Philippe Antoine about 1 month ago
- Related to Feature #9176: http2: support multipart/form-data added
JI Updated by Jason Ish about 1 month ago
JI Updated by Jason Ish about 1 month ago
- Disclosure Date set to 01/02/2027
JI Updated by Jason Ish about 1 month ago
- GHSA set to GHSA-7fvh-vrjw-pq5r
PA Updated by Philippe Antoine about 1 month ago
https://github.com/OISF/suricata/pull/16418 is the one for this issue
https://github.com/OISF/suricata/pull/16432 is not good for this issue as it tries to do more but as a draft
PA Updated by Philippe Antoine 27 days ago
- Status changed from In Review to Resolved
PA Updated by Philippe Antoine 26 days ago
- Status changed from Resolved to Closed
Actions