Advisory

GHSA-w253-m66g-rx24

Details, part 2 of 2. The advisory

Details

case "content-type":
    val := strings.ToLower(value)
    if strings.HasPrefix(val, "application/x-www-form-urlencoded") {
        tx.variables.reqbodyProcessor.Set("URLENCODED")
    } else if strings.HasPrefix(val, "multipart/form-data") {
        tx.variables.reqbodyProcessor.Set("MULTIPART")
    }

A request with two Content-Type headers therefore has its body-processor selection silently overwritten by the *last* one, since each call unconditionally calls Set. Meanwhile, ProcessRequestBody extracts the mimeType it passes to whichever processor gets selected from requestHeaders.Get("content-type")[0] -- the *first* value (internal/corazawaf/transaction.go, a few hundred lines below AddRequestHeader) -- and Go's net/http Header.Get (what a typical backend uses) also returns only the first value. So selection follows the last header while everything else follows the first, and the two can disagree entirely.

PoC

Content-Type: multipart/form-data; boundary=XyZ
Content-Type: application/x-www-form-urlencoded

with a genuine multipart body containing cmd=evil and a shell.php file upload. Against commit 19b86824:

  • reqbodyProcessor resolves to "URLENCODED" (the second, spoofed header wins).
  • The URL-encoded processor runs against the raw multipart body text, parses without error, and produces nothing.
  • ARGS_POST:cmd, FILES, and FILES_NAMES are all empty -- the entire payload is invisible to any rule inspecting those variables.
  • The backend (or any integrator using Header.Get, which reads the first value) still sees Content-Type: multipart/form-data and parses cmd=evil and the uploaded shell.php normally.

Current OWASP CRS includes rule 920620 (Content-Type header sanity check via count/format), which catches this shape; the recommended coraza.conf-recommended has no equivalent, so a Coraza deployment with only custom rules (no CRS) is exposed.

Fix

Only the first Content-Type header may set reqbodyProcessor: guard the existing logic with if tx.variables.reqbodyProcessor.Get() == "". This makes header-driven processor selection consistent with ProcessRequestBody's own mimeType extraction and with standard Header.Get semantics, without a new field (nothing else can set reqbodyProcessor before headers finish processing; ctl:requestBodyProcessor and ForceRequestBodyVariable both run afterward, in phase 1 rule evaluation and body processing respectively, and are unaffected).

As defense in depth, a rule author can also detect the anomaly directly today, with no code change: SecRule &REQUEST_HEADERS:Content-Type "@gt 1" "deny,..." -- left as a suggested addition to coraza.conf-recommended rather than bundled into this fix, since it is a policy choice (deny vs. flag) rather than a correctness requirement.

AI involvement disclosure

  • AI tools/models used: Claude Sonnet 5 (Anthropic), via Claude Code.
  • What was generated/assisted: the vulnerability hypothesis and repro shape were supplied by the reporter as an existing written finding; Claude Sonnet 5 independently re-derived the root cause by reading the current source, traced the mimeType/Header.Get first-value asymmetry, wrote and ran a fresh PoC against commit 19b86824 confirming the full bypass (ARGS_POST/FILES/FILES_NAMES all empty), verified the fix closes it, and drafted this addendum.
  • Review performed: reproduced by hand against a clean checkout of commit 19b86824 before and after the fix using the real Transaction API (AddRequestHeader x2, WriteRequestBody, ProcessRequestBody); confirmed the regression test fails deterministically against the pre-fix code and passes after it; ran the full test suite, the build-tag matrix (coraza.no_memoize, coraza.rule.multiphase_evaluation, coraza.rule.no_regex_multiline), and the testing/coreruleset CRS regression suite, all green; reviewed by a human maintainer (fzipi) before this addendum was submitted.

Fix: https://github.com/corazawaf/coraza-ghsa-w253-m66g-rx24/pull/2

Patched in 3.8.1

The 3.8.0 fix was incomplete. 3.8.1 completes it: only the first Content-Type header now selects the body processor (the one a typical backend reads with Header.Get), and leading whitespace in the media type, including Unicode whitespace that net/http accepts, is trimmed the way mime.ParseMediaType trims it. Upgrade to 3.8.1; 3.8.0 is listed as affected.

Severity (revised 2026-10-02)

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

Attack Complexity is Low: every form and multipart parser accepts these Content-Type values. The previous vector used Scope Unchanged (5.3).

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