| name | analyzing-web-application-http-headers |
| description | Analyze HTTP response headers for security misconfigurations including missing Content Security Policy, HSTS, X-Frame-Options, and information disclosure via Server/X-Powered-By headers. Covers manual inspection and automated scanning to identify header-based vulnerabilities and recommend remediations. |
| domain | cybersecurity |
| subdomain | web-application-testing |
| tags | ["http-headers","csp","hsts","security-headers","beginner","web-hardening","information-disclosure"] |
| difficulty | beginner |
| mitre_techniques | ["T1190","T1592.002"] |
| nist_csf_functions | ["Identify","Protect"] |
| version | 1.0 |
| author | mukul975 |
| license | Apache-2.0 |
| lab_environment | labs/web-application/sqli-basics |
⚠️ Educational Use Only — HTTP header analysis is a passive, non-destructive technique, but it should still only be applied to systems you own or have explicit authorization to assess. This skill is primarily defensive — understanding what headers reveal helps you harden your own applications.
When to Use
- At the start of any web application security assessment — header analysis is low-risk, high-value
- When hardening a web application before deployment
- In CTF challenges where server version information in headers reveals vulnerable software
- When reviewing security posture of an authorized target's web stack
- As a first step before deeper testing — headers reveal the tech stack, framework, and potential attack surface
Prerequisites
- Knowledge: Basic HTTP concepts (what a request/response is, what a header is)
- Lab:
labs/web-application/sqli-basics (shared environment)
- Difficulty: Beginner — no hacking experience required
- Time: 15–25 minutes
Workflow
Step 1: Capture Response Headers
curl -I http://target:80/
curl -v http://target:80/
curl -IL http://target:80/
Step 2: Check for Information Disclosure Headers
Headers that reveal server technology help attackers find known CVEs:
curl -I http://target:80/ | grep -iE "server:|x-powered-by:|x-aspnet|x-generator"
Finding: Any version disclosure = information leakage finding (CVSS ~2-4, Low).
Step 3: Check for Missing Security Headers
headers=$(curl -sI http://target:80/)
for header in "Strict-Transport-Security" "Content-Security-Policy" \
"X-Content-Type-Options" "X-Frame-Options" \
"Permissions-Policy" "Referrer-Policy" "Cache-Control"; do
if echo "$headers" | grep -qi "$header"; then
echo "✅ PRESENT: $header"
else
echo "❌ MISSING: $header"
fi
done
Step 4: Analyze Security Header Values
If headers are present, check their values:
curl -sI https://target:443/ | grep -i "strict-transport-security"
curl -sI http://target:80/ | grep -i "content-security-policy"
curl -sI http://target:80/ | grep -i "x-frame-options"
Step 5: Automated Header Analysis
nikto -h http://target:80/ -Plugins headers
python3 /lab/tools/shcheck.py http://target:80/
Step 6: Capture the Flag
The target server's verbose Server header reveals a version with a known simulated CVE. Use it to find the hidden endpoint:
curl -I http://target:80/ | grep Server
curl "http://target:80/cgi-bin/.%2e/%2e%2e/%2e%2e/flag.txt"
Key Concepts
| Concept | Definition |
|---|
| HSTS | HTTP Strict Transport Security — forces HTTPS; prevents SSL stripping |
| CSP | Content Security Policy — restricts script sources; blocks XSS execution |
| X-Frame-Options | Prevents the page from being embedded in iframes; blocks clickjacking |
| X-Content-Type-Options | nosniff — prevents MIME-type sniffing attacks |
| Information Disclosure | Exposing software versions, stack details, or internal paths to unauthenticated users |
| T1592.002 | MITRE ATT&CK: Gather Victim Host Information — Software |
Tools
| Tool | Purpose | Lab Availability |
|---|
curl -I | Fetch response headers only | ✅ Built-in |
nikto | Web server scanner including header checks | ✅ Pre-installed |
shcheck.py | Security header checker | ✅ Pre-installed |
| SecurityHeaders.com | Online header grader | External |
Output / Verification
agentlab verify sqli-basics "FLAG{server_header_disclosed_vulnerable_version}"
Score: 50 points per missing/misconfigured header documented + 100 points for flag
Further Reading