Method Override CSRF

Exploiting servers that let the HTTP method seen by the router or handler differ from the wire method (GET-reachable mutations, _method/X-HTTP-Method-Override, HEAD-as-GET, $_REQUEST merging), which simultaneously defeats SameSite=Lax and method-conditioned CSRF checks.

How it works

Two controls key on the method, and both break if the handler doesn’t:

  1. SameSite=Lax sends cookies on cross-site top-level safe-method navigations. If a mutation runs on GET, Lax is moot.
  2. CSRF middleware often validates only POST (or only non-safe methods) — if ($_SERVER['REQUEST_METHOD'] !== 'POST') return true; — or runs on the wire method while routing uses an override.

Override mechanisms: _method in query or body (Symfony, Laravel, Rails, Express method-override), X-HTTP-Method, X-HTTP-Method-Override headers (headers need same-origin JS; params work from a plain link/form), framework routers that send HEAD to the GET handler, and PHP $_REQUEST merging GET/POST/cookie input so a POST handler reads query params.

Techniques / payloads

Lax bypass: wire method GET (cookie attached on top-level nav), effective method POST:

GET /my-account/change-email?email=x%40evil.tld&_method=POST
<form action="https://target/account/transfer" method="GET">
  <input type="hidden" name="_method" value="POST">
  <input type="hidden" name="recipient" value="x"><input type="hidden" name="amount" value="1">
</form>

Test order:

  1. Replay the POST as GET with params in the query; then HEAD.
  2. If 405, add _method=POST (query), then in body for a POST → PUT/PATCH/DELETE downgrade (avoids preflight).
  3. Check whether the token check is skipped on the GET/HEAD variant even if the method is accepted.
  4. Look for other GET-reachable body channels (e.g. Apache Juneau’s content query param, CVE-2026-73099).
  5. GraphQL: send the mutation as GET ?query=.
  6. Deliver via top-level navigation (link, location=, window.open) — not <img>/iframe, which Lax strips.

Delivery to privileged users: admin bots or support staff that open links in tickets turn a GET CSRF into admin-context execution (bblabs lab of a $200 HackerOne report: password change accepting GET + ticket-reviewing admin bot).

Notable cases

Defenses

  • No side effects on safe methods — enforce at the router (explicit methods=["POST"]) and audit every GET/HEAD handler.
  • Disable method override, or allow it only on POST bodies and run CSRF validation on the effective method.
  • CSRF middleware: validate every non-safe effective method; never early-return on method.
  • Read inputs from the expected source only (no $_REQUEST).

Sources