HSTS header is present
Why it matters
Without HSTS, browsers will happily downgrade to HTTP on any request where the redirect is absent or stripped — a trivial attack on public Wi-Fi. HSTS instructs browsers to refuse HTTP connections entirely for the specified duration, eliminating the window where a man-in-the-middle can intercept the initial plaintext request. NIST SP 800-53 SC-8 and OWASP A02 (Cryptographic Failures) both flag the absence of HSTS as a transport security gap. A max-age below one year (31536000 seconds) leaves users exposed for shorter periods after each visit — insufficient to meaningfully protect repeat visitors. CWE-311 captures the failure: missing encryption of sensitive data in transit.
Severity rationale
High because a missing or short-lived HSTS header leaves a downgrade window open on every first visit or after the max-age expires, enabling interception without any vulnerability in the application itself.
Remediation
Add the Strict-Transport-Security header with a max-age of at least one year. In nginx:
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
In Next.js next.config.js:
async headers() {
return [{
source: '/(.*)',
headers: [{ key: 'Strict-Transport-Security', value: 'max-age=31536000; includeSubDomains' }]
}];
}
Do not set HSTS on HTTP — it is silently ignored and only takes effect over HTTPS. Confirm deployment with curl -sI https://yoursite.com | grep -i strict.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Site Health Check audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-311 — Missing Encryption of Sensitive Data
- owasp:2021 · A02 — Cryptographic Failures
- nist:rev5 · SC-8 — Transmission Confidentiality and Integrity
Taxons
History
- 2026-04-18·v1.0.0·Initial import from site-health-check·automated
- 2026-04-20·v1.1.0·Add Phase 6.0 detect-curl snippet for deterministic HSTS header probe·by cakleinman