Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

What Is CORS Misconfiguration?

A CORS misconfiguration is an overly permissive cross-origin policy that lets an attacker’s website read authenticated responses from your API using the victim’s own session.

Illustration for the cybersecurity term CORS Misconfiguration
Home / Blog / Cybersecurity Terms / What Is CORS Misconfiguration?
17 November 2026

What Is CORS Misconfiguration?

What Is CORS Misconfiguration?

Cross-Origin Resource Sharing is the mechanism that allows a page on one origin to read a response from another. It exists because the same-origin policy would otherwise block legitimate API calls from single-page applications. A CORS misconfiguration is a policy that relaxes that boundary too far, so a site controlled by an attacker can issue requests carrying the victim’s cookies and then read what comes back.

How the Negotiation Works

The browser adds an Origin header to the cross-origin request. The server answers with Access-Control-Allow-Origin, and optionally Access-Control-Allow-Credentials: true when cookies or client certificates should be included. For anything beyond a simple GET or form POST, the browser first sends an OPTIONS preflight and checks Access-Control-Allow-Methods and Access-Control-Allow-Headers before sending the real request.

Two points are easy to miss. The decision is enforced by the browser, not the server: a request that fails the check has usually already been processed. And the specification forbids combining a wildcard with credentials, which is precisely why developers reach for the dangerous alternative described below.

The Patterns That Go Wrong

What an Attacker Gains

With a permissive policy and the victim’s session cookie, a hostile page can read account details, API keys, and anti-CSRF tokens. The last of these matters: once a token can be read cross-origin, every state-changing endpoint protected by it is open, so a CORS flaw often becomes a cross-site request forgery chain. On internal systems the same trick reaches services the attacker cannot address directly, in much the same way as server-side request forgery, but driven from the browser.

Configuring It Safely

  1. Keep an explicit allow-list of full origins including scheme and port, compared with string equality rather than a regular expression.
  2. Never reflect the request origin unless it has matched that list first.
  3. Set credentials to true only where it is genuinely required, and never alongside a wildcard.
  4. Reject the null origin explicitly.
  5. Vary on Origin so a cached response for one origin is not served to another.
  6. Limit the methods and headers you advertise, and keep Access-Control-Max-Age short enough that policy changes take effect.

Remember that CORS is not an authorisation mechanism. It decides which origins may read a response; it says nothing about whether the caller should have been allowed to make the call. Server-side checks on identity and ownership still have to be present, and a public API that serves no credentials loses nothing by using a wildcard.

Testing is straightforward: replay each authenticated request with an arbitrary Origin header and inspect the response headers. Our web application security testing covers this across every endpoint rather than the handful a scanner samples.

FAQ – Frequently Asked Questions

Is a Wildcard Access-Control-Allow-Origin Always Unsafe?

Not always. Browsers refuse to send cookies or other credentials to a wildcard origin, so a genuinely public endpoint that returns the same data to everyone loses nothing by using one. It becomes dangerous on internal services reachable only from a corporate network, because an employee’s browser can bridge that gap on behalf of an external page.

Does CORS Protect My API?

No, and this is the most common misunderstanding. CORS relaxes a browser restriction; it never adds one. Any client that is not a browser, such as curl, a mobile app, or a server-side script, ignores the headers completely. Authentication, authorisation, and input validation must all be enforced server side regardless of what the CORS policy says.

Why Does a Preflight Request Appear Only Sometimes?

Simple requests skip it. A GET, HEAD, or POST that uses only standard headers and a basic content type is sent straight away, because a form could already have made it. Anything else, such as a JSON content type, a custom header, or a PUT or DELETE method, triggers an OPTIONS preflight first so the server can approve it.

How Do I Test for a CORS Misconfiguration?

Take an authenticated request, add an Origin header containing an unrelated domain, and look at the response. If the server echoes that origin back in Access-Control-Allow-Origin, or returns null, while also setting Access-Control-Allow-Credentials to true, the endpoint is exploitable. Repeat with a subdomain and with a domain that merely contains your hostname as a suffix.

Related Terms

You May Be Interested In These

What Is a PLC?

Cybersecurity Terms

17 November 2026

What Is a PLC?

Read More
What Is Responder?

Cybersecurity Terms

17 November 2026

What Is Responder?

Read More
What Is a Post-Incident Hardening Checklist?

Cybersecurity Terms

17 November 2026

What Is a Post-Incident Hardening Checklist?

Read More