CORS header checker
Paste the response headers of a CORS request and find misconfigurations: reflected origins, wildcard with credentials, the null origin, a missing Vary: Origin.
Send a request with an Origin header and paste what comes back. A page cannot read another site’s headers for you, so run the command yourself, or copy the headers from the Network tab of your browser’s developer tools.
curl -sI -H "Origin: https://evil.example" https://api.example.com/resource
Optional, but needed to tell whether the server reflects the origin.
Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.
How to use the CORS header checker
- Send a request with an Origin header, using the curl command shown and your own address.
- Enter the Origin you sent, and tick the box if the server has no reason to trust it.
- Paste the response headers.
- Read the findings and repeat with other origins, including null.
About this tool
A CORS misconfiguration turns a browser protection off for the wrong audience. The worst case is a server that answers any Origin with that same origin and allows credentials: every website your user visits can then call the API with their session and read the reply. This checker reads the headers of one response and tells you which of the known mistakes it shows.
To test for reflection, send a request with an Origin you made up, such as https://evil.example, and paste what comes back together with that origin. If the server echoes it, the list of allowed origins is not a list. Also try variations of your real domain, since prefix and suffix matching bugs let through names like example.com.evil.example.
The checker also looks for the null origin, for * combined with credentials (which browsers refuse, so the API is broken rather than open), for a specific origin without Vary: Origin, and for methods and headers opened with *. One response cannot prove a server is safe, and the rules here do not replace a review of the code that builds the headers.
Sources
Questions
Send requests with different Origin headers and compare the Access-Control-Allow-Origin that comes back. Try an unrelated origin, the value null, and names that contain your domain as a prefix or suffix. Any of those being allowed with Access-Control-Allow-Credentials: true is a serious finding.
It makes every website an allowed origin. With credentials enabled, a malicious page can make the visitor’s browser call your API with their cookies and hand the response to the attacker. Without credentials the exposure is limited to what the server gives anyone who can reach it.
It tells caches that the response depends on the Origin request header. Without it, a CDN or browser cache can store a response that allows one origin and serve it to another, which fails or, worse, mixes up who may read what. Send it whenever the allowed origin is chosen per request.
Not for data that is public anyway. Browsers send no cookies with such requests. It becomes a problem when the server trusts the network instead of a login, for example an internal API reachable only from the office, because any website can then read it through an employee’s browser.