- by x32x01 ||
Host Header Injection is a common but dangerous web vulnerability that can lead to serious issues like password reset poisoning, cache poisoning, open redirects, and SSRF.
In this guide, you’ll learn practical and real-world ways to detect Host Header Injection vulnerabilities, using simple techniques that every pentester, bug bounty hunter, and security researcher should know.
Normally, a request looks like this:
If the application blindly uses this value in redirects, emails, or links, an attacker can manipulate it 🚨.
🔍 If the response reflects or trusts this value, the app may be vulnerable.
🚩 If the app uses attacker.com internally, this is a strong indicator.
💡 Misconfigured apps may treat this as a trusted domain.
If the app includes the port in generated links, it may be exploitable.
This often exposes weak virtual host validation.
Some servers process the last Host header, others the first - both can be abused.
This tests fallback behavior in reverse proxy setups.
Many applications trust this header when behind load balancers.
🚨 These are often forgotten during security hardening.
If multiple sites share the same IP, virtual host confusion can occur.
✔️ Focus on password reset functionality
✔️ Combine with cache poisoning
✔️ Test behind proxies and CDNs
✔️ Document impact clearly
By mastering these techniques, you significantly increase your chances of finding high-impact bugs in real-world applications 🚀.
In this guide, you’ll learn practical and real-world ways to detect Host Header Injection vulnerabilities, using simple techniques that every pentester, bug bounty hunter, and security researcher should know.
What Is Host Header Injection? 🧠
Host Header Injection happens when a web application trusts the Host header sent by the client without proper validation.Normally, a request looks like this:
Code:
GET /admin.php HTTP/1.1
Host: target.com Why Host Header Injection Is Dangerous ⚠️
This vulnerability can be abused to:- Poison password reset links
- Bypass authentication
- Perform cache poisoning attacks
- Abuse reverse proxy configurations
- Enable phishing attacks
Test 1: Adding a Malicious Prefix 🧪
Try modifying the Host header with a fake domain: Code:
GET /admin.php HTTP/1.1
Host: hackertarget.com Test 2: Using an Absolute URL in the Request Line 🌐
Some servers accept absolute URLs instead of paths: Code:
GET https://target.com/admin.php HTTP/1.1
Host: attacker.com Test 3: Subdomain Injection 🔑
Try sending a subdomain of the target: Code:
GET /admin.php HTTP/1.1
Host: subdomain.target.com Test 4: Changing the Port Number 🔌
Code:
GET /admin.php HTTP/1.1
Host: target.com:8080 Test 5: Using the Target IP Address 🖥️
Code:
GET /admin.php HTTP/1.1
Host: 192.168.1.10 Test 6: Multiple Host Headers 🧩
Send more than one Host header: Code:
GET /admin.php HTTP/1.1
Host: target.com
Host: attacker.com Test 7: Blank Host Header 🚫
Code:
GET /admin.php HTTP/1.1
Host:
X-Forwarded-Host: attacker.com Test 8: X-Forwarded-Host Header 🔄
Code:
GET /admin.php HTTP/1.1
Host: target.com
X-Forwarded-Host: attacker.com Test 9: Other Proxy Headers 🧪
Some servers accept alternative headers: Code:
X-Host: attacker.com
X-Forwarded-Server: attacker.com
X-HTTP-Host-Override: attacker.com
Forwarded: host=attacker.com Test 10: Another Website on the Same IP 🌍
Code:
GET /admin.php HTTP/1.1
Host: target2.com How to Confirm the Vulnerability ✅
A Host Header Injection is confirmed if:- The Host value appears in redirects
- Password reset emails contain attacker-controlled domains
- Absolute URLs use the injected host
- Cache behavior changes
Tools That Help with Host Header Testing 🛠️
- Burp Suite
- OWASP ZAP
- curl
- Custom scripts
Code:
curl -H "Host: attacker.com" https://target.com Best Practices for Bug Bounty Hunters 💡
✔️ Test all endpoints, not just login✔️ Focus on password reset functionality
✔️ Combine with cache poisoning
✔️ Test behind proxies and CDNs
✔️ Document impact clearly
Final Thoughts 🔐
Host Header Injection vulnerabilities are often overlooked but can lead to critical security issues if exploited correctly.By mastering these techniques, you significantly increase your chances of finding high-impact bugs in real-world applications 🚀.
Last edited: