Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
HTTP Strict Transport Security (HSTS) is a security mechanism that forces browsers to communicate with websites only over HTTPS. When properly implemented, HSTS protects against protocol downgrade attacks, SSL stripping, and cookie hijacking. This test verifies that the HSTS header is present, properly configured, and includes appropriate directives.
What to Check
HSTS Header Directives
Directive
Description
Recommended
max-age
Time in seconds to enforce HTTPS
>= 31536000 (1 year)
includeSubDomains
Apply HSTS to all subdomains
Yes
preload
Include in browser preload lists
Recommended
Verification Points
HSTS header present on HTTPS responses
max-age value is sufficiently long
includeSubDomains directive present
preload directive present (optional)
Header not sent over HTTP
All subdomains support HTTPS (if includeSubDomains)
"[WARN] max-age is less than 1 year ($max_age seconds)"
else
echo
"[PASS] max-age: $max_age seconds"
fi
# Check includeSubDomains
if
echo
"$hsts"
"includesubdomains"
then
echo
"[PASS] includeSubDomains present"
else
echo
"[WARN] includeSubDomains not present"
fi
# Check preload
if
echo
"$hsts"
"preload"
then
echo
"[PASS] preload directive present"
else
echo
"[INFO] preload not present (optional)"
fi
Step 3: Verify HTTP Redirect
# Check that HTTP redirects to HTTPS
curl -sI http://target.com | head -10
# Should return 301/302 redirect to HTTPS# HSTS header should NOT be sent over HTTP
curl -sI http://target.com | grep -i strict-transport
Step 4: Test Subdomain Coverage
# If includeSubDomains is set, verify all subdomains support HTTPS
subdomains=("www""api""mail""app""admin")
for sub in"${subdomains[@]}"; do
host="${sub}.target.com"echo"=== $host ==="# Check HTTPS works
https_status=$(curl -s -o /dev/null -w "%{http_code}""https://$host" 2>/dev/null)
echo"HTTPS Status: $https_status"# Check HSTS on subdomain
curl -sI "https://$host" 2>/dev/null | grep -i strict-transport
done
Step 5: Check Preload Status
# Check if domain is in HSTS preload list# Visit: https://hstspreload.org/?domain=target.com# Or use API
curl -s "https://hstspreload.org/api/v2/status?domain=target.com" | jq
# Check for missing HSTS
nuclei -u https://target.com -t http/misconfiguration/http-missing-security-headers.yaml
Remediation Guide
1. Implement HSTS Header
Apache
# In httpd.conf or .htaccess
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
</IfModule>
Nginx
# In server block
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;