# Referer and Origin Validation Bypasses > Failures of header-based CSRF defenses (Origin, Referer, `Sec-Fetch-Site`): fail-open on a missing header, substring/regex matching, exempt entry points, trusting same-site, and browser behaviors that put the target's own origin into an attacker-triggered request's Referer. ## How it works `Origin`, `Referer` and `Sec-Fetch-*` are forbidden headers, so page JS cannot forge them — the defense is sound only if the comparison is an **exact origin match** and **absence fails closed**. Practical gaps: - **Absence.** Browsers omit `Referer` under `Referrer-Policy: no-referrer` / `<meta name="referrer" content="no-referrer">` (or legacy `never`) / `referrerpolicy` attributes; `Origin` is missing on many same-origin GETs and some form posts, and `Origin: null` appears under `no-referrer` in Chromium form POSTs. Missing or `null` is not evidence of same-origin. - **Loose matching.** `includes`/`startsWith`/unanchored regex accept `https://target.com.evil.tld`, `https://evil.tld/?target.com`, `https://evil.tld/target.com`. - **Site vs origin.** `Sec-Fetch-Site: same-site` is honest for sibling subdomains; policies that trust `same-site` (or only reject `cross-site`) inherit every sibling's XSS, upload and takeover risk. - **Header not evaluated.** Middleware that skips the check for some content types (`text/ping`), routes (exemption lists) or "index" pages. - **Referer = target via sub-resources.** Under default `strict-origin-when-cross-origin`, a request initiated *by a stylesheet or JS module hosted on the target* carries the target's origin as Referer, even when the attacker's page linked that resource. ## Techniques / payloads Suppress Referer: ```html <meta name="referrer" content="no-referrer"> <form action="https://target/admin.php?action=installmodule" method="POST" referrerpolicy="no-referrer" enctype="multipart/form-data">…</form> ``` Launder the trusted string into the Referer (substring checks): ```html <meta name="referrer" content="unsafe-url"> <!-- default policy strips the query --> <script>history.pushState('', '', '/?target.com'); document.forms[0].submit()</script> ``` Sub-resource Referer (afine research): upload a file served as `text/css` whose `url()` points at a GET mutation on the target; link it from the attacker page with `<link rel=stylesheet>` — the resulting request's Referer is the target. Only `text/css` works for stylesheets; cookies are not attached cross-site, so it becomes useful when linked from a same-site context. The JS-module variant has the same Referer behavior and accepts more content types but needs credentialed CORS for cookies. Checklist: 1. Remove `Referer`; remove `Origin`; send `Origin: null`. 2. Lookalike prefix/suffix domains and query/path embedding. 3. HTTP vs HTTPS and port variants (exact origin includes scheme and port). 4. From a sibling subdomain: does `Sec-Fetch-Site: same-site` pass? 5. Find entry points exempt from the check (index pages, OAuth/webhook routes) that redirect or chain into setters. 6. Loopback/local services: missing Origin/Host checks enable DNS rebinding and browser-to-localhost CSRF. ## Notable cases - **Pluck CMS 4.7.20 (CVE-2026-78748, CVSS 8.8)** — Referer check logs a warning and returns `true` when the header is absent; any admin action incl. module install (→ RCE). [[raw/plaintext.block8.ai/the-bouncer-who-waves-you-in-with-no-name-tag-pluck-cms-missing-refere-14676|The bouncer who waves you in with no name tag: Pluck CMS missing-Referer CSRF (CVE-2026-78748)]] - **Tasmota ≤ 16.0.0 (CVE-2026-119755)** — `HttpCheckPriviledgedAccess()` substring check passes `http://.evil.com/<device-host>`; arbitrary console commands. [[raw/github.com/tasmota-through-16-0-0-csrf-high-13926|Tasmota through 16.0.0 CSRF (high)]] - **Webmin 2.670 firewalld** — `index.cgi` is Referer-exempt and 302s into `default_zone.cgi`, which blocks foreign Referers when hit directly; `referers_none=1` default doesn't close the hop. [[raw/abraxaslabs.tech/webmin-2-670-firewalld-index-cgi-csrf-sets-zone-to-trusted-14677|Webmin 2.670 firewalld index.cgi CSRF sets zone to trusted]] - **Warpgate 0.19.0–0.29.x (GHSA-qcwp-cwqv-g428)** — no `Origin`/`Sec-Fetch-Site` check plus `SameSite=None`; bodiless `POST` endpoints approve tickets, grant admin roles, close sessions; fixed in 0.30.0 with origin + `Sec-Fetch-Site` checks. [[raw/github.com/warpgate-cross-site-admin-actions-without-origin-check-13245|Warpgate cross-site admin actions without origin check]] - **Hono `csrf()`** — Origin/`Sec-Fetch-Site` not evaluated for `text/ping`. [[raw/github.com/hono-csrf-misses-hyperlink-auditing-text-ping-posts-13246|Hono csrf() misses hyperlink auditing text/ping POSTs]] - **Coder** — unanchored exemption regex skipped the same-origin check too. [[raw/github.com/coder-csrf-protection-skipped-for-api-paths-matching-unanchored-exempt-13924|coder: CSRF protection skipped for API paths matching unanchored exemption patterns]] - **Playwright MCP Server < 0.0.40 (CVE-2025-9611)** — no Origin validation on the localhost HTTP transport → DNS rebinding invokes MCP tools; fix adds `allowedHosts`/`allowedOrigins`. [[raw/sentinelone.com/cve-2025-9611-microsoft-playwright-mcp-server-csrf-flaw-4652|CVE-2025-9611: Microsoft Playwright MCP Server CSRF Flaw]] - **"Eight Doors" ATO** — server never inspected `Origin`/`Referer`, so it could not backstop broken token validation. [[raw/medium.com/eight-doors-one-key-chaining-misconfigurations-into-full-account-takeo-12490|Eight Doors, One Key: Chaining Misconfigurations into Full Account Takeover]] ## Defenses - Exact match of `Origin` against an allow-list of full origins; fall back to Referer origin only when `Origin` is absent; reject when neither yields a trusted origin (and reject `null`). - `Sec-Fetch-Site`: allow `same-origin` (and `none` for user-typed navigations); treat `same-site` as untrusted unless every sibling is trusted; fall back to Origin checks when `Sec-Fetch-*` is missing. Go 1.25 `http.CrossOriginProtection` implements this. - Apply checks independent of content type, route and method; anchor any exemption. - Use as a layer with tokens, not instead — the afine sub-resource behavior shows Referer-only defenses are weaker than they appear. - Localhost services: validate `Host` and `Origin`. ## Related - [[Cross-Site Request Forgery]] - [[CSRF Prevention]] - [[SameSite Cookies]] - [[CSRF Token Bypasses]] - [[DNS Rebinding]] - [[MCP Security]] ## Sources - [[raw/afine.com/bypassing-referer-based-csrf-with-strict-origin-when-cross-origin-12035|Bypassing Referer-Based CSRF with strict-origin-when-cross-origin]] - [[raw/plaintext.block8.ai/the-bouncer-who-waves-you-in-with-no-name-tag-pluck-cms-missing-refere-14676|The bouncer who waves you in with no name tag: Pluck CMS missing-Referer CSRF (CVE-2026-78748)]] - [[raw/github.com/tasmota-through-16-0-0-csrf-high-13926|Tasmota through 16.0.0 CSRF (high)]] - [[raw/abraxaslabs.tech/webmin-2-670-firewalld-index-cgi-csrf-sets-zone-to-trusted-14677|Webmin 2.670 firewalld index.cgi CSRF sets zone to trusted]] - [[raw/github.com/warpgate-cross-site-admin-actions-without-origin-check-13245|Warpgate cross-site admin actions without origin check]] - [[raw/github.com/hono-csrf-misses-hyperlink-auditing-text-ping-posts-13246|Hono csrf() misses hyperlink auditing text/ping POSTs]] - [[raw/github.com/coder-csrf-protection-skipped-for-api-paths-matching-unanchored-exempt-13924|coder: CSRF protection skipped for API paths matching unanchored exemption patterns]] - [[raw/sentinelone.com/cve-2025-9611-microsoft-playwright-mcp-server-csrf-flaw-4652|CVE-2025-9611: Microsoft Playwright MCP Server CSRF Flaw]] - [[raw/medium.com/eight-doors-one-key-chaining-misconfigurations-into-full-account-takeo-12490|Eight Doors, One Key: Chaining Misconfigurations into Full Account Takeover]] - [[raw/intigriti.com/csrf-advanced-exploitation-guide-intigriti-4254|CSRF: Advanced Exploitation Guide - Intigriti]] - [[raw/cobalt.io/csrf-bypasses-cobalt-3427|CSRF & Bypasses - Cobalt]] - [[raw/medium.com/csrf-the-bug-everyone-declared-dead-and-nobody-actually-fixed-13022|CSRF: The Bug Everyone Declared Dead and Nobody Actually Fixed]] - [[raw/book.hacktricks.xyz/csrf-cross-site-request-forgery-hacktricks-2874|CSRF (Cross Site Request Forgery) - HackTricks]] - [[raw/mixmax.com/using-cors-policies-to-implement-csrf-protection-mixmax-932|Using CORS policies to implement CSRF protection - Mixmax]] - [[raw/cheatsheetseries.owasp.org/cross-site-request-forgery-prevention-cheat-sheet-owasp-2877|Cross-Site Request Forgery Prevention Cheat Sheet - OWASP]] - [[raw/developer.mozilla.org/cross-site-request-forgery-csrf-security-mdn-web-docs-2991|Cross-site request forgery (CSRF) - Security - MDN Web Docs]]