Apex Flow Shield Free scan
Menu

What is a CORS misconfiguration?

CORS is the browser rule set that decides whether one website may read responses from another. The dangerous mistake is a server that copies whatever website asks into its Access-Control-Allow-Origin header and also sends Access-Control-Allow-Credentials: true. That lets any website a logged-in visitor opens read that visitor's private data from your site.

What the Shield scan checks

Cross-site data access, shown beside your score. It is not part of the 100 points. Shield requests your HTTPS home page once more with an Origin header naming a made-up website. The check reports a finding only when the response copies that made-up website into Access-Control-Allow-Origin and also sends Access-Control-Allow-Credentials: true. Shield checks the home page only, not every address on your site.

If the check finds a problem, the scan tells you: The site lets any other website read logged-in data from it. Limit Access-Control-Allow-Origin to websites you trust.

What CORS is

By default a browser will not let a page on one website read a response from another website. CORS is how a server makes exceptions. It answers with headers that say which other websites may read the response, and whether the visitor's cookies may be included.

The dangerous combination

Access-Control-Allow-Origin: https://whoever-asked.example
Access-Control-Allow-Credentials: true

When the first line is simply a copy of whatever website made the request, every website is trusted. With the second line, the browser also sends the visitor's login cookies. A hostile page can then read account pages on your site while the visitor is logged in.

How to fix it

  1. Keep a short, fixed list of the websites that truly need access, and only answer with one of those exact names.
  2. Never build the header from the incoming Origin without checking it against that list.
  3. Send Access-Control-Allow-Credentials: true only where a trusted website needs the visitor's login.
  4. Add Vary: Origin when the answer changes by website, so caches do not mix answers up.

Check your website for open CORS now

Type your website address to run the free scan. It checks this and the other 10 items. No account, no email.

The interactive scan needs JavaScript. See the checks you can run yourself.

Questions

Is Access-Control-Allow-Origin: * dangerous?

By itself it only shares responses that are already public, because browsers will not send cookies with a wildcard. It is the wrong choice for anything private, and fine for truly public files such as fonts.

Does CORS protect my server from attacks?

No. CORS only tells browsers which websites may read a response. It does not stop a request from reaching your server, so it is not a replacement for logins and permission checks.

My website has no logins. Does this matter?

Much less. The risk is about data that belongs to a logged-in visitor. A site with nothing private has little to leak this way.

Sources

Written by Apex Flow Labs LLC for Apex Flow Shield. A score of 100 means the responses Shield received passed all 11 of its checks. It does not prove each setting is configured well, and no scan can show that a website cannot be attacked.

All website security guides