Header-Based Access Control Bypass
Defeating an access gate that keys its decision on request metadata the client controls (override headers, client-IP headers,
Referer,Host/Origin, framework-internal headers) or on a path the gate parses differently from the router behind it.
How it works
The gate and the handler see different requests. Either the gate trusts a header that only a proxy should set but that the client can send too, or a front component (WAF, reverse proxy, middleware) authorizes path A while the back end routes the same bytes to path B. Authorization at the “platform layer” (URL + method rules) is especially exposed, because the rule describes the request rather than the principal.
Techniques / payloads
URL override headers (PortSwigger: front-end blocks /admin/deleteUser, back-end honours the override):
POST / HTTP/1.1
X-Original-URL: /admin/deleteUser
Also X-Rewrite-URL. Pair with method swaps (GET for a POST-only deny rule).
Client-IP spoofing against IP allowlists / “localhost only” admin:
X-Forwarded-For: 127.0.0.1
X-Real-IP: 127.0.0.1
X-Client-IP / X-Remote-IP / X-Originating-IP / True-Client-IP / CF-Connecting-IP: 127.0.0.1
Try each independently and compare against a 403 baseline. The standardized Forwarded: header has the same problem: Rails, Spring and Jetty can be tricked into trusting spoofed client IP and host values when proxies don’t strip it.
Referer gating: sub-pages that only check Referer: https://site/admin. Same idea on storage: a Volcengine TOS bucket returned 403 with no or foreign Referer, and 200 with Referer: https://<target-domain>/, exposing 10+ GB of customer PII ($6K, chained with an unauthenticated upload signer).
Host/Origin allowlists on local services: CircleCI’s shared MCP server accepted any request with Host: localhost and no Origin. The check only stops browsers, and any non-browser client sets both (GHSA-xv5j-cwgj-22r4, unauthenticated RCE with the org’s CircleCI token). Virtual-host probing (Host: admin.target.com, X-Forwarded-Host) finds unadvertised admin apps; see Host Header SSRF.
Framework-internal headers: Next.js CVE-2025-29927 (CVSS 9.1; < 13.5.9 / 14.2.25 / 15.2.3). The internal x-middleware-subrequest header, meant to stop middleware recursion, was accepted from external clients and skipped middleware entirely, including the auth/authz checks most apps put there. The exact header value varies by version. Self-hosted only; Vercel and Netlify weren’t affected. Workaround: strip the header at the edge.
Path-matching differentials (gate vs router):
| Trick | Why it works |
|---|---|
| /ADMIN/DELETEUSER | router case-insensitive, gate case-sensitive |
| /admin/deleteUser.anything | Spring useSuffixPatternMatch (default on before 5.3) |
| /admin/deleteUser/ | trailing slash treated as a distinct path by the gate |
| /static%2f..;/openidm/info/ping | Jetty canonicalizes %2f..; for servlet selection while the WAF and outer rule see /static/...; reached ForgeRock OpenIDM and the Felix console /static%2f..;/system%2fconsole;/bundles/.json at two automakers |
jhaddix’s “403 bypass” list catalogues 77 such URL manipulations. BugQuest and Invicti both include method tampering and path variations as standard BAC checks.
Notable cases
- Next.js CVE-2025-29927: one header bypassed middleware auth across self-hosted Next.js.
- ForgeRock path confusion (Sam Curry et al.): WAF bypass to OpenIDM/AM admin surfaces, leading to RCE and remote vehicle access at two automakers.
- CircleCI MCP server: Host/Origin “auth” defeated by curl.
- Volcengine TOS: Referer as the only read control on a PII bucket, $6K.
- SaaS network ACL: a related pattern where IP allowlists are per-user objects, removable via IDOR (see Privilege Escalation).
Defenses
- Never base authorization on client-settable headers. Derive client IP only from a trusted proxy hop count, and have the edge strip
X-Forwarded-*,Forwarded,X-Original-URL,X-Rewrite-URLand framework-internal headers from inbound traffic. - Authorize in the application on the principal, not on URL patterns at a proxy. If you must use path rules, normalize once (decode, resolve dot segments, lowercase or reject mixed case, strip matrix params
;) and make the gate and router share that normalizer. - Don’t make middleware the only authz layer. Re-check in the handler or data layer (Function Level Authorization).
- Local/dev servers (MCP, debug ports) need real authentication, not Host/Origin checks.
Related
- Authorization Security
- Broken Access Control
- Function Level Authorization
- Host Header SSRF
- URL Parser Differentials
- MCP Security
Sources
- Access Control Vulnerabilities and Privilege Escalation - PortSwigger · original
- CVE-2025-29927 Authorization Bypass in Next.js Middleware · original
- Header Manipulation: Bypasses, Probing, and the Security Audit Nobody Does · original
- Forwarded Without Question: How Web Frameworks Overtrust the Forwarded Header · original
- 403 Bypass list by @jhaddix Url Manipulation Methods Top 77 ways to bypass access control #bugbountytip #bu... · original
- Broken Access Control: How to Detect and Prevent · original
- BugQuest 2026: 31 Days of Broken Access Control · original
- One Header Away from 10+ GB of Customer Documents (PII) — $6K Bounty · original
- Unauthenticated RCE in CircleCI's MCP server: Host/Origin allowlist bypassed by any non-browser client (GHS... · original
- Hacking Two Automakers: ForgeRock Path Confusion, RCE, and Remote Vehicle Access · original
- Privilege Escalation via IDOR and ACL Bypass in SaaS · original