Security Headers Checker
Analyze your website's security headers for vulnerabilities and compliance with OWASP security best practices.
Analyzing Security Headers...
Checking CSP, HSTS, X-Frame-Options and other security protocols.
report-uri /csp-report-endpoint
Why Security Headers Are Critical for Web Security
Security headers are HTTP response headers that instruct browsers how to behave when handling your website's content. They provide an additional layer of protection against common web vulnerabilities like Cross-Site Scripting (XSS), clickjacking, MIME sniffing attacks, and data leakage.
According to OWASP (Open Web Application Security Project), proper implementation of security headers can prevent over 70% of common web attacks. The absence of critical security headers is a frequent finding in security audits and penetration tests.
Detailed Analysis of Each Security Header
1. Content-Security-Policy (CSP) - The Most Important Header
Purpose: Prevents Cross-Site Scripting (XSS) and data injection attacks by specifying which content sources are trusted.
Implementation Levels:
- Level 1 (Basic):
default-src 'self'- Only allow resources from same origin - Level 2 (Moderate): Add specific directives for scripts, styles, images
- Level 3 (Advanced): Include
report-urifor violation reporting - Level 4 (Strict): Use nonces or hashes for inline scripts/styles
Common Mistakes: Too restrictive CSP breaking functionality, missing report-uri, allowing unsafe-inline or unsafe-eval without proper justification.
2. Strict-Transport-Security (HSTS) - HTTPS Enforcement
Purpose: Forces browsers to use HTTPS only, preventing SSL stripping attacks and protocol downgrades.
Optimal Configuration:
Parameters Explained:
- max-age=31536000: 1 year duration (in seconds)
- includeSubDomains: Apply to all subdomains
- preload: Eligibility for browser preload lists
Warning: Once implemented, removing HSTS can be difficult. Start with shorter max-age for testing.
3. X-Frame-Options - Clickjacking Protection
Purpose: Prevents your site from being loaded in frames, which protects against clickjacking attacks.
Options:
DENY: No framing allowed (most secure)SAMEORIGIN: Allow framing by same origin onlyALLOW-FROM uri: Allow framing from specific URI (deprecated)
Modern Alternative: Use CSP's frame-ancestors directive which offers more flexibility.
4. X-Content-Type-Options - MIME Sniffing Prevention
Purpose: Prevents browsers from MIME-sniffing a response away from the declared content-type.
Simple but Critical: Just set it to nosniff. This prevents attacks where attackers upload malicious files with incorrect MIME types.
5. Referrer-Policy - Privacy Protection
Purpose: Controls how much referrer information is sent with requests.
Recommended Policy: strict-origin-when-cross-origin
- Same-origin: Send full URL
- Cross-origin HTTPS to HTTPS: Send origin only
- HTTPS to HTTP: Send no referrer
6. Permissions-Policy (formerly Feature-Policy)
Purpose: Controls which browser features and APIs can be used.
Example: camera=(), microphone=(), geolocation=() disables these features by default unless explicitly allowed.
Security Headers Scoring Methodology
Our scoring system (0-100) is based on OWASP recommendations and industry best practices:
| Header | Weight | Points | Description |
|---|---|---|---|
| Content-Security-Policy | 25% | 0-25 | Critical for XSS protection |
| Strict-Transport-Security | 20% | 0-20 | Essential for HTTPS enforcement |
| X-Frame-Options | 15% | 0-15 | Clickjacking prevention |
| X-Content-Type-Options | 10% | 0-10 | MIME sniffing prevention |
| Referrer-Policy | 10% | 0-10 | Privacy protection |
| Other Headers | 20% | 0-20 | X-XSS-Protection, Permissions-Policy, etc. |
Common Security Header Implementation Issues
1. CSP Breaking Website Functionality
Problem: Overly restrictive CSP blocks legitimate scripts, styles, or fonts.
Solution: Implement CSP in report-only mode first: Content-Security-Policy-Report-Only. Monitor violations, then deploy the actual policy.
2. HSTS Configuration Errors
Problem: Setting HSTS on HTTP site or incorrect max-age values.
Solution: Always implement HTTPS first. Start with max-age=300 (5 minutes) for testing, then increase to 31536000 (1 year).
3. Missing Subdomain Coverage
Problem: HSTS or CSP not applied to all subdomains.
Solution: Use includeSubDomains directive and test all subdomains.
4. Server Information Disclosure
Problem: Server headers revealing software versions and configurations.
Solution: Remove or obfuscate Server, X-Powered-By, and X-AspNet-Version headers.
Industry Compliance Standards
Proper security headers implementation helps meet various compliance requirements:
Requirement 6.5: Address common coding vulnerabilities
Data protection by design and by default
Information security controls
Protect function (PR.AC-3)
Frequently Asked Questions (FAQ)
What is the difference between security headers and SSL/TLS certificates?
SSL/TLS certificates encrypt data in transit between the browser and server. Security headers control browser behavior and provide additional security protections. They work together: SSL provides encryption, while security headers like HSTS enforce SSL usage and CSP prevents XSS attacks even over encrypted connections.
Can security headers be bypassed or exploited?
While security headers significantly improve security, they are not foolproof. Attackers can sometimes bypass weak CSP configurations or exploit misconfigurations. However, properly configured security headers make attacks much more difficult and are considered essential for web application security.
Should I use both X-Frame-Options and CSP frame-ancestors?
Yes, for maximum compatibility. Modern browsers that support CSP will use frame-ancestors and ignore X-Frame-Options. Older browsers will use X-Frame-Options. Set both with consistent policies: X-Frame-Options: SAMEORIGIN and frame-ancestors 'self' in CSP.
How do I test if my CSP is working correctly?
Use multiple methods:
- Deploy CSP in report-only mode first
- Monitor browser console for violations
- Use CSP evaluator tools online
- Test with different browsers
- Check CSP violation reports if report-uri is configured