Skip to content

Bug class · Beginner

CORS misconfiguration

A permissive cross-origin policy lets another site read responses with the user's credentials.

median public bounty
$1,000

Covers CWE 942, 346.

How it works

Full lesson

The pattern behind every report in this class.

A cross-origin misconfiguration is a server or client component that tells the browser to let other websites read its responses when it should not. In the reports behind this lesson the usual shape is a server that copies whatever Origin the request carries into the cross-origin response header and also permits credentials, instead of checking that origin against a fixed list of trusted sites. The browser then does exactly what it was told: a page on an attacker-controlled site can make a request to the vulnerable service with the victim's cookies attached and read the answer. The same class of mistake appears in looser forms, such as suffix or substring matching on the trusted domain, wildcard policies on endpoints that carry user data, and local daemons or extensions that never check where a request came from.

Programs care because the impact is often direct account compromise rather than a theoretical leak. Reports in this set show misconfigurations leading to reading a session identifier and taking over an account, reading a temporary mail token and using it to redirect a victim's share codes, reading admin login pages and their CSRF nonces to change an admin password, and leaking personal data such as email addresses and subscription details. Some reports go further and describe stealing money or full account takeover through a chain. Because the flaw sits in a response header, it is easy to miss in normal testing and easy to fix badly, which is why it keeps appearing.

It turns up most often on API endpoints that return personal or session data, on WordPress REST API and oEmbed endpoints, on identity-aware proxies and single sign-on bridges, on OAuth bridges that check the host parameter but not the embedding page, on local JSON-RPC and WebSocket interfaces used by desktop tools and browser extensions, and on SockJS information endpoints configured to allow all origins. It also appears in framework middleware such as flask-cors, in HTML embeds that run with the parent site's origin, and in browser-level handling of service worker fetches and downloads. The common thread is a component that decides trust from something the requester controls, or that never makes the decision at all.

Start with the browser's same-origin rule. A page on one site cannot normally read responses from another site. The cross-origin mechanism is the controlled exception: the server sends response headers naming which origins may read the response, and whether cookies and other credentials may be included. The browser enforces the decision, so the whole security property rests on the server making that decision correctly. When the server reflects the request's Origin value back and also allows credentials, it has effectively granted every site on the internet the same access as the user's own browser session.

Things to try

All 73

Each line worked in a disclosed report. Test only what a program's scope allows.

Named third-party products and platforms 17

  • Check Linear for a simple cross-origin misconfiguration that discloses a sensitive token.
  • Check a support site's gateway for a permissive cross-origin policy that lets another site read user details such as email addresses and IDs.
  • Test an ads portal endpoint for a cross-origin policy that lets another site read ticket information when a user clicks a link.
  • Test Grafana for cross-origin request forgery against its endpoints.

Browser and extension cross-origin handling 11

  • From a malicious page, import a local HTML file through a link element with rel=import and see whether a wildcard cross-origin header lets you read local files.
  • Check whether a man-in-the-middle position on the Flash Player settings manager allows setting sandbox settings.
  • Start a background fetch with credentials set to omit against a site that returns a wildcard cross-origin header and check whether cookies are still sent and the response readable.
  • From a web page, send a socket command to a browser extension's content script and see whether the background page opens WebSocket connections to arbitrary URLs with the extension's cookies.

API endpoints and token disclosure 10

  • Send a request to an API endpoint with an Origin header for a domain you control and check whether it is reflected in the cross-origin response with credentials allowed.
  • Check whether a profile endpoint accepts any HTTP subdomain as a trusted origin and lacks CSRF token validation, then try reading and changing settings through a man-in-the-middle position.
  • Host a page that makes a credentialed cross-origin request to an API endpoint and see whether a logged-in visitor's subscription data can be read.
  • Check whether a profile endpoint returns more personal fields than needed while its API trusts arbitrary origins, then try reading it from a crafted link.

Chaining with CSRF, XSS and account takeover 9

  • Look for ways to chain a cross-origin misconfiguration with other bugs to extend a limited scope.
  • Create a site with an HTML embed containing script that makes a credentialed same-origin request to the parent site and forwards the response, then check whether CSRF tokens and email addresses leak.
  • Test whether connection sockets combined with a cross-origin misconfiguration allow full account takeover.
  • Check whether a cross-origin misconfiguration can be used to steal money.

Domain and subdomain trust matching 8

  • Register a domain that merely ends with the trusted domain name and test whether the server trusts it for credentialed cross-origin reads.
  • Test whether an application's origin validation fails for crafted origins.
  • Host a page on a domain whose name contains the trusted string and test whether the server accepts it for credentialed cross-origin requests.
  • Send Origin values containing two domains separated by a space, then replace the space with a URL-encoded backtick and a controlled subdomain, and see which are reflected.

Bypasses and variations

  • Chain a cross-origin misconfiguration with a self-XSS on a user-controlled subdomain to get around the SameSite cookie restriction.
  • Use a specially crafted domain containing special characters that some browsers accept to exploit subdomain trust.

Typical fixes

All 14
  • Check the origin against an exact allowlist rather than reflecting it, and do not allow credentials for unknown origins.
  • Fix case sensitivity, regex path matching and inconsistent matching in flask-cors.
  • Validate the embedding page's origin and use the postMessage target origin rather than relying on the Referer header.
  • Validate the sender's origin before forwarding messages from content scripts to the background page.
  • Honour the request's credentials mode when attaching cookies in background fetches.
  • Validate the Origin and Content-Type headers on local JSON-RPC interfaces.

Tips for beginners

All 14
  • Begin with endpoints that return something worth stealing: session identifiers, API tokens, CSRF nonces, email addresses, subscription or ticket details. A permissive policy on a page with no sensitive content is hard to turn into a valid report, so pick targets where the response itself is the impact.
  • Send a request with an Origin header for a domain you control and look at what comes back. If your origin is reflected and credentials are allowed, you have the core finding. Then confirm it from an actual page in a browser with a signed-in session, because the header alone does not prove the browser will let you read the response.
  • Try the matching weaknesses deliberately. Register or use a domain that merely ends with the trusted name, one that contains the trusted string, and one that begins with the trusted domain. Compare which are reflected or redirected. These tests distinguish a real allowlist from suffix, substring or prefix matching.
  • Check the WordPress REST API index and oEmbed endpoints on blog and main domains with an arbitrary Origin header, then attempt a credentialed cross-origin fetch. These endpoints have a track record of reflecting the Origin without validating it, and they are common enough that a first hunt can start there.
  • Look at identity-aware proxies and single sign-on flows. Request a protected domain with an arbitrary Origin and see whether it is reflected with credentials allowed, then try reading a signed-in user's email. For a user not yet signed in, the sign-in window can be opened and the proxy polled until login completes.
  • Test OAuth bridges by embedding one with a legitimate consumer key and host and using messaging from the embedding page to try to retrieve credentials. Also try suppressing the Referer header, since a bridge that treats a missing Referer as a match will accept you. Validate only what the evidence shows: the check was on the host parameter, not the embedding page.

Start here: a reading path

Open the path

Clear reports in order, easiest first.

Guides and techniques

View all

The best explainers, cheat sheets and technique posts on CORS, from around the web.

Newest reports

All 250

Most recently disclosed.

New CORS reports by email

Follow CORS and get each week's new disclosures in one short email.

Free. New reports for what you follow, weekly by default. One-click unsubscribe. Privacy