Security #9157
Updated by Jason Ish about 2 months ago
Original report
<pre>
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
</pre>
LOW severity as limited scope evasion
GitHub ID for credit: 0xkalawy