# Origin Reflection and Validation Flaws > Server-side `Origin` checks that echo an attacker-controlled origin into `Access-Control-Allow-Origin`, either with no validation at all or through string matching that an attacker-registered host satisfies. This is the root of most credentialed [[CORS Misconfiguration]] findings. ## How it works ACAO holds a single origin, so a server that trusts several origins has to read `Origin`, decide, and echo it back. Every flaw below is a mistake in that decision ([[raw/outpost24.com/exploiting-trust-weaponizing-permissive-cors-configurations-6598|Outpost24]]). The intended logic is an exact set-membership check ([[raw/darkrelay.com/http-security-headers-a-complete-guide-to-http-headers-6594|DarkRelay]]): ```js // correct: exact match on full origin const ALLOWED = new Set(["https://app.target.com", "https://admin.target.com"]); if (ALLOWED.has(req.headers.origin)) { res.set("Access-Control-Allow-Origin", req.headers.origin); res.set("Access-Control-Allow-Credentials", "true"); res.set("Vary", "Origin"); } ``` ## Techniques / payloads | Flaw | Server logic (paraphrased) | Probe origin | |---|---|---| | Blind reflection | `ACAO = req.Origin` | `https://evil.com` | | Prefix match | `origin.startsWith("https://target.com")` | `https://target.com.evil.com` | | Unanchored regex / substring | `/target\.com/.test(origin)` | `https://target.com.evil.com`, `https://eviltarget.com` | | Suffix without dot | `origin.endsWith("target.com")` | `https://eviltarget.com` | | All subdomains | `*.target.com` regex | any taken-over or XSSable subdomain | | `localhost` prefix | `origin.startsWith("http://localhost")` | `http://localhost.evil.com` | | Special characters | regex assumes `[a-z0-9.-]` | `https://target.com_.evil.com` (Chrome/Firefox accept `_`; Safari is far looser) | | `null` | `null` in allowlist | sandboxed iframe, see [[Null Origin and Credentialed CORS]] | Sources for the rows: blind reflection, `startsWith`, localhost, subdomain and underscore cases ([[raw/outpost24.com/exploiting-trust-weaponizing-permissive-cors-configurations-6598|Outpost24]]); reflection of `evil.com`, `null` and `httpbin.org.evil.com` all confirmed with one curl loop ([[raw/infosecwriteups.com/header-manipulation-bypasses-probing-and-the-security-audit-nobody-doe-9157|Header Manipulation]]); the unanchored regex in Flickr's fragment loader ([[raw/masimshahzad.medium.com/one-missing-anchor-one-flickr-xss-14346|Flickr XSS]]). **Context-dependent trust.** Some endpoints return no CORS headers for their own origin but do trust a sibling. In Outpost24's case, `ta.app.io` trusted `travel-advice.com`, and the same `startsWith` flaw applied to it. Burp's built-in check only tries the scanned host, so it misses these. Fuzz the Origin over enumerated related domains first, then run the bypass set against each trusted one ([[raw/outpost24.com/exploiting-trust-weaponizing-permissive-cors-configurations-6598|Outpost24]]): ``` Origin: https://§sub.target.com§ # Intruder, URL-encoding off; grep ACAO ``` **Third-party platforms on the allowlist.** Developers allowlist GitHub Pages, CodePen or Replit for development and forget to remove them. Hosting the PoC there satisfies the check ([[raw/intigriti.com/31-bite-sized-tips-and-bug-bounty-resources-for-2026-3611|Intigriti tips]]). **Subdomain trust is not safe.** A takeover or XSS on any trusted subdomain gives a full read of the main origin. OWASP explicitly calls subdomain-regex CORS the "less secure" configuration because of [[Subdomain Takeover]] ([[raw/intigriti.com/hunting-down-subdomain-takeover-vulnerabilities-4870|Intigriti STO]], [[raw/cheatsheetseries.owasp.org/cross-site-request-forgery-prevention-cheat-sheet-owasp-2877|OWASP CSRF CS]]). Same-site subdomain requests also carry `SameSite=Lax/Strict` cookies that have a `Domain` attribute ([[raw/outpost24.com/exploiting-trust-weaponizing-permissive-cors-configurations-6598|Outpost24]]). Mixed-content variant: trusted `http://` subdomains abused by MITM ([[raw/portswigger.net/top-10-web-hacking-techniques-of-2025-call-for-nominations-4820|Top 10 2025 nominations]]). **Wordlists.** PortSwigger's URL validation bypass cheat sheet has a dedicated "CORS origin" context. Enter the allowed domain and an attacker domain and it generates domain-confusion, fake-relative and loopback payloads (Outpost24 contributed the localhost bypass) ([[raw/portswigger.net/introducing-the-url-validation-bypass-cheat-sheet-197|PortSwigger intro]], [[raw/portswigger.net/url-validation-bypass-cheat-sheet-2024-edition-web-security-academy-5105|cheat sheet]]). The parser-confusion theory is in [[URL Parser Differentials]]. ## Notable cases - **Bank**: blind reflection on `/getSessionToken`, giving session hijack ([[raw/outpost24.com/exploiting-trust-weaponizing-permissive-cors-configurations-6598|Outpost24]]). - **Travel booking app**: `startsWith` check, access-token theft, email change, ATO (same source). - **Mobile carrier**: trusted `localhost` through a prefix check (same source). - **Games retailer**: arbitrary subdomain reflection exposing a Base64 session cookie (same source). - **vAPI API7**: `Origin: evil.com` echoed with ACAC, leaking `authkey` ([[raw/medium.com/exploiting-all-10-owasp-api-security-risks-in-vapi-bonus-arena-challen-14687|vAPI]]). - **$1,500 bounty**: API domain with no origin allowlist plus ACAC; an XHR PoC read org and user data ([[raw/link.medium.com/the-bugs-are-out-there-hiding-in-plain-sight-1067|Bugs in Plain Sight]]). - **Flickr (2013)**: unanchored regex let an attacker page serve HTML through CORS into `innerHTML`, giving XSS ([[raw/masimshahzad.medium.com/one-missing-anchor-one-flickr-xss-14346|Flickr XSS]]). - **Index of classic reflection writeups** (pre-domain wildcard, BTC site, Google 404): [[raw/github.com/awesome-bug-bounty-writeups-curated-list-by-bug-type-2127|Awesome Bug Bounty Writeups]]. ## Defenses - An exact-match set of full origins. No regex, no `startsWith`/`endsWith`/`contains`, and no reflection fallback ([[raw/cheatsheetseries.owasp.org/http-headers-6630|OWASP HTTP Headers]]). - List specific subdomains rather than `*.domain`. Accept the maintenance cost ([[raw/outpost24.com/exploiting-trust-weaponizing-permissive-cors-configurations-6598|Outpost24]]). - Strip dev, localhost and third-party-hosting origins from production configs. - If you must parse, parse the origin as a URL and compare the scheme, host and port tuple. Don't use string tests (the Flickr fix) ([[raw/masimshahzad.medium.com/one-missing-anchor-one-flickr-xss-14346|Flickr XSS]]). ## Related - [[CORS Misconfiguration]] (main guide) · [[Null Origin and Credentialed CORS]] · [[CORS on Internal and Local Services]] - [[URL Parser Differentials]] · [[Referer and Origin Validation Bypasses]] · [[Subdomain Takeover]] · [[Cross-Site Scripting]] ## Sources - [[raw/outpost24.com/exploiting-trust-weaponizing-permissive-cors-configurations-6598|Exploiting trust: Weaponizing permissive CORS configurations]] - [[raw/cheatsheetseries.owasp.org/http-headers-6630|HTTP Headers]] - [[raw/cheatsheetseries.owasp.org/cross-site-request-forgery-prevention-cheat-sheet-owasp-2877|Cross-Site Request Forgery Prevention Cheat Sheet - OWASP]] - [[raw/darkrelay.com/http-security-headers-a-complete-guide-to-http-headers-6594|HTTP Security Headers: A complete guide to HTTP headers]] - [[raw/infosecwriteups.com/header-manipulation-bypasses-probing-and-the-security-audit-nobody-doe-9157|Header Manipulation: Bypasses, Probing, and the Security Audit Nobody Does]] - [[raw/intigriti.com/31-bite-sized-tips-and-bug-bounty-resources-for-2026-3611|31 Bite-Sized Tips and Bug Bounty Resources for 2026]] - [[raw/github.com/awesome-bug-bounty-writeups-curated-list-by-bug-type-2127|Awesome Bug Bounty Writeups - Curated List by Bug Type]] - [[raw/masimshahzad.medium.com/one-missing-anchor-one-flickr-xss-14346|One Missing Anchor, One Flickr XSS]] - [[raw/medium.com/exploiting-all-10-owasp-api-security-risks-in-vapi-bonus-arena-challen-14687|Exploiting All 10 OWASP API Security Risks in vAPI (+ Bonus Arena Challenges)]] - [[raw/portswigger.net/url-validation-bypass-cheat-sheet-2024-edition-web-security-academy-5105|URL validation bypass cheat sheet]] - [[raw/portswigger.net/introducing-the-url-validation-bypass-cheat-sheet-197|Introducing the URL validation bypass cheat sheet]] - [[raw/link.medium.com/the-bugs-are-out-there-hiding-in-plain-sight-1067|The Bugs Are Out There, Hiding in Plain Sight]] - [[raw/intigriti.com/hunting-down-subdomain-takeover-vulnerabilities-4870|Hunting down subdomain takeover vulnerabilities]] - [[raw/portswigger.net/top-10-web-hacking-techniques-of-2025-call-for-nominations-4820|Top 10 Web Hacking Techniques of 2025: Call for Nominations]]