Offensive security
HTTP security headers: what to check on your site
A practical review of the HTTP headers that protect your users, and how to check in a minute whether your site sends them.
- By
- STRIXPROOF Research
- 1 min read
Security headers are instructions your server gives the browser to limit what a page can do. They do not replace secure code, but they reduce the impact of many attacks and are cheap to implement.
The ones we check first
| Header | What it does |
|---|---|
Strict-Transport-Security |
Forces the browser to always use HTTPS. |
Content-Security-Policy |
Defines where scripts, styles and images may load from. Limits the impact of XSS. |
X-Content-Type-Options: nosniff |
Stops the browser from guessing a file's type. |
X-Frame-Options or frame-ancestors |
Prevents your site from being embedded in another (clickjacking). |
Referrer-Policy |
Controls how much of the URL is sent to other sites. |
How to check
Just request your site's headers:
curl -sI https://your-site.example | grep -iE "strict-transport|content-security|x-content-type|x-frame|referrer"
If the command returns nothing, your site is not sending any of them.
Common mistakes
- A CSP with
unsafe-inlineand*. It exists, but protects very little. It is better to start with a strict policy inReport-Onlymode and adjust from there. - HSTS without reviewing subdomains.
includeSubDomainsbreaks any subdomain that still only works over HTTP. - Headers only on the home page. They must be sent on every response, including error pages.
Headers are one more layer. If you want to know how exposed your application really is, that question is answered by testing it.
- #web
- #headers