4 Simple Steps to Detect HTTP Header Security Issues on a Web App Using Kali Linux
HTTP headers play a crucial role in web security, yet they are often overlooked. Misconfigured or missing HTTP security headers can expose your web application to attacks like host header injection, XSS, clickjacking, and MIME sniffing. In this comprehensive guide, we’ll walk you through how to test HTTP header security using Kali Linux tools such as Curl, WhatWeb, Nikto, and Burp Suite. Whether you’re an ethical hacker, bug bounty hunter, or IT admin, this tutorial will help you check security headers effectively. For more cybersecurity insights, visit FaizanTech Core. What Are HTTP Headers? Before diving into testing, let’s understand what HTTP headers are. HTTP Headers Explained HTTP headers are key-value pairs sent between a web server and a client (browser). They control: Why HTTP Header Security Matters A missing HTTP security headers vulnerability can lead to: Testing headers security ensures your web app isn’t exposed to these risks. Why You Must Test HTTP Header Security Attackers exploit weak HTTP header security to:✔ Bypass security controls (CORS misconfigurations)✔ Steal session tokens (insecure Set-Cookie flags)✔ Perform phishing via Host header injection✔ Trigger MIME-based attacks (missing X-Content-Type-Options) By checking security headers, you can prevent these exploits. Step 1: View Raw Headers with Curl Curl is a command-line tool to fetch HTTP responses. Use it to check security headers quickly. Command: curl -I http://testphp.vulnweb.com/test.php HTTP Header Security Analysis Target: http://testphp.vulnweb.com/test.phpServer IP: 44.228.249.3Web Server: nginx/1.19.0Backend: PHP/5.6.40Status Code: 404 Not Found Identified Risks 1. Exposed Server Version 2. Exposed PHP Version 3. Information Disclosure on Error Pages Best Practices (Recommendations) Action Recommendation Hide Technology Stack Disable Server and X-Powered-By headers in server config Upgrade Outdated Software Replace PHP 5.6 with a currently supported and secure version Implement Security Headers Add headers like X-Frame-Options, X-Content-Type-Options, Content-Security-Policy Sanitize Error Responses Configure friendly 404 pages that don’t reveal internal details Reference Resources Step 2: Use WhatWeb for Technology Fingerprinting WhatWeb scans websites to detect backend technologies, helping identify outdated software. Command: whatweb http://testphp.vulnweb.com/test.php WhatWeb Scan Analysis Report Target URL: http://testphp.vulnweb.com/test.phpHTTP Status: 404 Not FoundIP Address: 44.228.249.3Country: United States (US)Web Server: nginx/1.19.0Backend Language: PHP/5.6.40X-Powered-By Header: PHP/5.6.40-38+ubuntu20.04.1+deb.sury.org+1 Identified Security Issues 1. Outdated Web Server (nginx/1.19.0) 2. End-of-Life PHP Version (5.6.40) 3. Leaking Technology Stack via Headers 4. 404 Page Leaking Sensitive Info Overall Security Rating: Low to Medium Your application is exposing outdated and potentially vulnerable components through its HTTP headers. This increases the attack surface and aids in reconnaissance during the early stages of a cyberattack. Recommended Immediate Actions # Action Description 1 Upgrade PHP Move from PHP 5.6 to PHP 8.1+ to reduce exposure to known vulnerabilities. 2 Update Nginx Upgrade to the latest secure version (as of now, 1.24.0+) 3 Hide Headers Disable or sanitize Server and X-Powered-By headers 4 Harden Error Pages Ensure 404 and 500 error pages do not leak backend info 5 Implement HTTP Security Headers Add X-Frame-Options, X-Content-Type-Options, Referrer-Policy, etc. Further Reading Step 3: Scan with Nikto for Missing Security Headers Nikto is a web server scanner that detects header vulnerabilities. Command: nikto -h http://testphp.vulnweb.com/test.php Nikto Web Vulnerability Scan Report Target: http://testphp.vulnweb.com/test.phpIP Address: 44.228.249.3Web Server: nginx/1.19.0Backend: PHP/5.6.40Scan Tool: Nikto v2.5.0Scan Duration: 118 secondsStatus: Completed with 3 findings and 20 errors Key Vulnerabilities Identified Other Notes Recommended Actions Issue Priority Action Missing security headers High Add X-Frame-Options, X-Content-Type-Options Exposed PHP version High Upgrade to PHP 8.1+ and hide version info Outdated server software Medium Upgrade nginx to a supported version Error limit reached Medium Rerun scan with throttling (-Tuning option) Step 4: Intercept and Test with Burp Suite Burp Suite is a powerful tool that helps you manually test for HTTP header security flaws, such as unauthorized access to admin areas via header manipulation. Steps to Perform the Test: Risk Identified: Bonus: Online Tools to Check Security Headers For quick scans, use: These tools check security headers and grade your site’s HTTP header security. Tools Used in This Guide Tool Purpose Curl View raw HTTP headers WhatWeb Detect server & tech stack Nikto Scan for missing security headers Burp Suite Manual header testing & injection Conclusion Testing HTTP header security is essential to prevent attacks like host header injection, XSS, and clickjacking. Using Kali Linux tools, you can:✔ Detect missing security headers✔ Check for outdated server versions✔ Test header injection vulnerabilities Next Steps: For more penetration testing guides, visit FaizanTech Core.
4 Simple Steps to Detect HTTP Header Security Issues on a Web App Using Kali Linux Read More »