HSTS includes includeSubDomains
Why it matters
HSTS without includeSubDomains protects only the apex domain — api.yourdomain.com, cdn.yourdomain.com, and auth.yourdomain.com remain vulnerable to SSL stripping attacks even when the main domain enforces HTTPS. An attacker on the same network can intercept unencrypted traffic to any unprotected subdomain and inject content or credentials. CWE-311 and CWE-319 both apply — data transmitted to subdomains over HTTP is exposed in cleartext. OWASP A02 (Cryptographic Failures) identifies incomplete HSTS configuration as a transport security gap that leaves backend APIs and CDN endpoints unprotected.
Severity rationale
High because omitting `includeSubDomains` leaves all subdomains — including API, auth, and CDN endpoints that handle credentials and session tokens — vulnerable to SSL stripping despite main-domain HSTS being configured.
Remediation
Add includeSubDomains to your HSTS header configuration. Before doing so, verify that every subdomain your application uses has a valid TLS certificate — a subdomain without HTTPS becomes unreachable once HSTS covers it.
// next.config.js
headers: [{
source: '/(.*)',
headers: [{
key: 'Strict-Transport-Security',
value: 'max-age=31536000; includeSubDomains'
}]
}]
Audit your DNS for all active subdomains before adding includeSubDomains: dig +short yourdomain.com and check your DNS provider's zone file. Any subdomain serving HTTP-only content will break.
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 Security Headers II Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-311
- cwe · CWE-319 — Cleartext Transmission of Sensitive Information
- owasp:2021 · A02
- soc2:2017 · CC6.6 — Protection against threats from outside system boundaries
Taxons
History
- 2026-04-18·v1.0.0·Initial import from security-headers-ii·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (CC6.6) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2