Advisory

GHSA-3wr7-993q-jrff

Details, part 2 of 2. The advisory

Details

Both spellings stay quiet on a part with no filename* at all, because the
collections are then absent rather than empty and the rule never evaluates.
That is what makes an allowlist rule safe to apply to all traffic rather than
only to known upload fields.

Discrepancies are no longer dropped silently

The same silent-fallback pattern this advisory describes existed on two neighbouring paths: a part whose Content-Disposition was present but unparseable, and a part carrying a filename* that did not match the charset'[language]'value shape at all. Both were reduced to a part with no filename — routed into ARGS_POST, outside FILES-scoped rule coverage, with nothing to signal that a filename had been discarded.

Both now raise MULTIPART_STRICT_ERROR (rule 200003 in CRS). A part with *no* Content-Disposition at all is not flagged: it simply carries no filename. mime.ParseMediaType accepts every real-world filename shape tested — raw UTF-8 and emoji, spaces, Windows backslashes, a bare %, unquoted values — so this signal does not reach legitimate uploads.

New variable: MULTIPART_DUPLICATE_PART_HEADER

Set to 1 when a part repeats a header (two Content-Disposition headers) or repeats a parameter inside its Content-Disposition (two filename parameters). A duplicate is precisely where backends disagree about which value wins, so the duplicate itself is the signal; it also contributes to MULTIPART_STRICT_ERROR.

SecRule MULTIPART_STRICT_ERROR "@eq 1" "id:201,phase:2,deny,t:none,chain"
  SecRule MULTIPART_DUPLICATE_PART_HEADER "@eq 1"

ModSecurity adds the same variable in its fix for GHSA-5pww-8rfg-9crf and lists it in the recommended audit-log format as DH. Coraza implements it under the same name so that a rule set referencing it parses on both engines.

Note on percent-decoding

Coraza percent-decodes the filename* value, so MULTIPART_FILENAME and FILES hold the name the application will actually resolve. This matters for rules that match on file extension: CRS 933110 and 944140 target FILES with t:none,t:lowercase,t:removeWhitespace and perform no URL decoding, so an encoded separator such as filename*=UTF-8''shell%2Ephp would evade them if the raw value were stored instead. ModSecurity's fix stored the raw, still-encoded value when this was first written; after the difference was raised on its advisory it now percent-decodes as well, so the two engines agree on this point.

Three further discrepancies found in post-fix review

Reviewing the fix (23446b5e) against test coverage turned up three more cases where Coraza's parsed value could disagree with what a backend resolves, closed in f30df398:

  • An unresolvable % escape in filename* (filename*=UTF-8''safe.jpg%ZZ) is still kept as-is rather than substituting a decoy plain filename, but now also raises MULTIPART_STRICT_ERROR. Without this, the discrepancy was silent whenever a backend decoded the same escape differently or rejected it outright.
  • A quoted filename* value (filename*="UTF-8''shell.php") is unwrapped before parsing. RFC 5987 does not permit filename* to be a quoted-string, but a general Content-Disposition parser such as Go's mime.ParseMediaType accepts a quoted value for any parameter. Without unwrapping, the literal quote characters ended up in MULTIPART_FILENAME/MULTIPART_FILENAME_CHARSET, so an anchored rule (e.g. \.php$) did not match a filename the backend resolved cleanly.
  • MULTIPART_FILENAME, MULTIPART_FILENAME_CHARSET, MULTIPART_FILENAME_LANGUAGE and MULTIPART_NAME are multi-valued collections: two parts sharing one name (e.g. a multi-file upload field) each keep their own filename instead of the later part overwriting the earlier one. ModSecurity's fix for GHSA-5pww-8rfg-9crf independently identifies and fixes the same class of bug, describing it as "a second, distinct bypass," by keeping the equivalent variables multi-valued.

The precedence decision itself was found to relocate the bypass

Reviewing filename*-as-authoritative, @jptosso demonstrated (with a repro against Go's own mime/multipart as the reference backend) that this precedence choice doesn't close the two-sided decoy: it only decides which of the two payload shapes above is caught, not both. Checked against ModSecurity v3's actual fix for GHSA-5pww-8rfg-9crf: it makes the identical unconditional-precedence choice (single value, filename* wins, plain filename discarded), with no record of the two-sided case being considered there either — this is not a case of Coraza deviating from a more careful upstream fix.

Fixed in 89399e67 by keeping both readings rather than picking one (see Resolution above). Test coverage for the original PoC direction only ever exercised the filename="safe.jpg"; filename*=...''shell.php order; the swapped order (filename="shell.php"; filename*=...''safe.jpg) is now a dedicated regression case, since that gap in coverage is exactly why the one-sided version shipped in the first place.

Patched in 3.8.1

The 3.8.0 fix was incomplete. 3.8.1 completes it: an RFC 2231 numbered continuation (filename*0=, filename*0*=, ...) next to a bare filename* parameter now sets MULTIPART_STRICT_ERROR, and the Content-Disposition duplicate-parameter check added in 3.8.0 is now linear instead of quadratic in the number of parameters. Upgrade to 3.8.1; 3.8.0 is listed as affected.

Severity (revised 2026-10-02)

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:L/A:N (4.0, Medium).

Attack Complexity is High because the bypass depends on a specific backend behaviour outside the attacker's control. Go's mime.ParseMediaType and PHP resolve the same filename Coraza did, so they are not affected. The discrepancy exists only for backends that decode a non-UTF-8 filename* or treat a filename*-only part as a file, such as Werkzeug/Flask and busboy-based Node.js backends (Express with multer, Fastify). The continuation case fixed in 3.8.1 is resolved only by Werkzeug. The previous vector scored Attack Complexity Low (5.8).

Impact metrics follow the convention used across Coraza's WAF-bypass advisories: the vulnerable component is Coraza, but the impact lands on the protected application, so Scope is Changed. The bypass hides a payload from inspection; the application still has to be vulnerable to it, so Integrity is Low and Confidentiality is not scored separately.

_AI involvement in this section: Claude Opus 5.5 (Anthropic), via Claude Code, re-derived the CVSS vector from the project's triage guidance (AGENTS.md, "CVSS preconditions get verified, not copied from the report") and drafted this text. A human maintainer (fzipi) chose the S:C/I:L impact convention and directed this update._

Sources & licences