Skip to content
-
Learn Cybersecurity & Ethical Hacking in Nepal with CyberSamir — Start Learning →
Cyber Samir Cyber Samir Cyber Samir

Learn Cybersecurity, Ethical Hacking & Bug Bounty in Nepal

Cyber Samir Cyber Samir Cyber Samir

Learn Cybersecurity, Ethical Hacking & Bug Bounty in Nepal

  • Home
  • About Us
  • Blogs
    • Ethical Hacking
    • Cybersecurity
    • Penetration testing
  • Tools
    • Phishing email Detector tool
    • Website Security Checker Tool
    • Age|Face Shape|Expression Guess
    • Text Cleaner Tool
    • Image Converter & Resizer Tool (Free Online)
  • Contact Us
  • Home
  • About Us
  • Blogs
    • Ethical Hacking
    • Cybersecurity
    • Penetration testing
  • Tools
    • Phishing email Detector tool
    • Website Security Checker Tool
    • Age|Face Shape|Expression Guess
    • Text Cleaner Tool
    • Image Converter & Resizer Tool (Free Online)
  • Contact Us
Close

Search

Subscribe
  • Facebook
  • Telegram
  • Instagram
  • Youtube
  • Linkedin
  • Whasapp
Cyber Samir Cyber Samir Cyber Samir

Learn Cybersecurity, Ethical Hacking & Bug Bounty in Nepal

Cyber Samir Cyber Samir Cyber Samir

Learn Cybersecurity, Ethical Hacking & Bug Bounty in Nepal

  • Home
  • About Us
  • Blogs
    • Ethical Hacking
    • Cybersecurity
    • Penetration testing
  • Tools
    • Phishing email Detector tool
    • Website Security Checker Tool
    • Age|Face Shape|Expression Guess
    • Text Cleaner Tool
    • Image Converter & Resizer Tool (Free Online)
  • Contact Us
  • Home
  • About Us
  • Blogs
    • Ethical Hacking
    • Cybersecurity
    • Penetration testing
  • Tools
    • Phishing email Detector tool
    • Website Security Checker Tool
    • Age|Face Shape|Expression Guess
    • Text Cleaner Tool
    • Image Converter & Resizer Tool (Free Online)
  • Contact Us
Close

Search

Subscribe
  • Facebook
  • Telegram
  • Instagram
  • Youtube
  • Linkedin
  • Whasapp
Penetration testing

Host Header Injection

By cybersamir
May 29, 2025 3 Min Read
Comments Off on Host Header Injection

Host Header Injection: When the Web Server Trusts Too Much

Exploiting the web’s implicit trust in the Host header

Advertisement

⚠️ Ethical Note: Only test Host header vulnerabilities on systems you own or have explicit permission to test.

What is Host Header Injection?

Host Header Injection occurs when a web application improperly uses the HTTP Host header without proper validation or sanitization. This trust can lead to various attacks including:

  • Web cache poisoning
  • Password reset poisoning
  • SSRF (Server-Side Request Forgery)
  • Cross-site scripting (XSS)
  • Business logic bypasses
1
Attacker sends malicious Host header
Example: Host: evil.com
2
Server trusts the header
Uses it to generate links, emails, or perform actions
3
Application behaves unexpectedly
Generates malicious content or performs unintended actions

Advertisement

Why This Vulnerability Exists

Root Cause Example Impact
Implicit trust in headers Using Host header for password reset links Account takeover
Lack of validation Accepting arbitrary Host values Cache poisoning
Improper canonicalization Treating example.com and example.com.malicious.com as same Phishing attacks

Exploitation Techniques

Basic Host Header Manipulation

GET / HTTP/1.1
Host: evil.com

Common Attack Vectors

  • Password Reset Poisoning: Injecting malicious host in reset emails
  • Cache Poisoning: Storing malicious responses in CDN caches
  • SSRF Attacks: Using Host header to reach internal services
  • XSS via Host Header: When Host value is reflected unsanitized
  • Virtual Host Brute Forcing: Discovering hidden internal domains

Advertisement

Advanced Exploitation

1. Password Reset Poisoning

POST /password-reset HTTP/1.1
Host: evil.com
...
email=victim@real.com

2. Web Cache Poisoning

GET / HTTP/1.1
Host: evil.com
X-Forwarded-Host: attacker.com

3. SSRF via Host Header

GET /internal-resource HTTP/1.1
Host: 169.254.169.254

Testing Methodology

Test Payload Expected Result
Basic override Host: evil.com Site uses evil.com in links/redirects
Duplicate headers Two Host headers See which one the app processes
Absolute URLs GET http://evil.com/ HTTP/1.1 Server processes evil.com as host
Port manipulation Host: evil.com:80 Check if port is validated

Advertisement

Defensive Strategies

1. Secure Server Configuration

# Nginx configuration
server {
    listen 80;
    server_name example.com;
    if ($host != "example.com") {
        return 444;
    }
    ...
}

2. Application-Level Protections

  • Whitelist acceptable domain names
  • Never use Host header for sensitive operations
  • Use relative URLs instead of host-based absolute URLs
  • Validate and sanitize all header values
  • Implement proper CORS policies

3. Security Headers

Content-Security-Policy: default-src 'self'
X-Frame-Options: DENY
Referrer-Policy: strict-origin-when-cross-origin
Pro Tip: Use the SERVER_NAME variable in frameworks rather than reading the Host header directly.

Real-World Examples

Case 1: Password Reset Hijacking

A popular SaaS platform used the Host header to generate password reset links, allowing attackers to steal tokens by setting Host: attacker.com.

Case 2: Cache Poisoning Attack

Major news site cached responses with malicious Host headers, serving JavaScript from attacker domains to all visitors.

Case 3: Internal Service Access

E-commerce platform allowed Host header to reach internal metadata services (like AWS metadata service).

Advertisement

Conclusion

Host Header Injection remains a serious threat because many frameworks implicitly trust headers, and testing often misses header manipulation. The impact can range from XSS to complete account takeover.

Remember: The Host header is completely attacker-controlled – treat it with the same suspicion as any other user input.

Further Resources

  • PortSwigger Host Header Attacks
  • OWASP Testing Guide

Tags:

Host Header AttackHost header exploitHost Header InjectionHost header manipulationHost header security flawHost Injection OWASPHost spoofing attackHTTP Host Header InjectionPrevent Host Header InjectionWeb vulnerability Host Header
Author

cybersamir

Follow Me
Other Articles
Previous

High-Ranking VPNs for Nepal

Next

What Is WordPress & Why You Should Learn It in 2025

Your ad here

300 x 250 banner slot

Reach Nepali students, developers, and security learners reading about ethical hacking, CTFs, and cyber news.

Book on WhatsApp Or send an email

Sponsors: VPNs, courses, hosting, security tools

Recent Posts

  • How to Recover Money from Online Scam Nepal: 2026 Guide
  • How to Check If Your Data Was Leaked (Nepal 2026 Guide)
  • Is PHP Dead? A 2026 Reckoning
  • Nepal Cyber Shield CTF: Top 10 Teams Qualified for the Grand Finale
  • How to Report Cybercrime in Nepal: Step-by-Step Guide (2026)

Nepal Cyber Shield 2026

Been scammed or hacked?

Act fast: save screenshots, don't delete chats, and report it.

  • 100 Nepal Police emergency line
  • +9779851286770 Nepal Police Cyber Bureau
Report here (Nepal Police) Read the step-by-step reporting guide

Money lost? Call your bank first so they can try to freeze the transfer.

Categories

  • Awareness
  • Blog
  • Career & Learning
  • Cybersecurity
  • Ethical Hacking
  • Nepal Tech & Digital Safety
  • News
  • Penetration testing
  • Tools & Reviews

Latest security alerts

  • pCloud Password Manager Hit by Cyber Attack Involving Email Address Exposure and Login Attempts
  • Suspected Vietnam-Linked Hackers Target Southeast Asia in South China Sea Espionage Campaign
  • Microsoft Store App Found Delivering Vinci RAT Capable of Remote System Control
  • How to Keep Your Security Picture Current When Attackers Move at AI Speed
  • Hackers Trojanize Official Q-Dir and DesktopOK Downloads to Deliver Remote Access Malware
  • PHP Vulnerability And Global Cybersecurity - The Rising Nepal
  • Nepal's digital vulnerability goes beyond PHP - myRepublica
  • SEBON introduces IT policy to strengthen cybersecurity in Nepal’s capital market - OnlineKhabar English News
  • From heartbleed to PHP2Shell: Is Nepal ready for the next cyber crisis? - The Annapurna Express
  • SEBON steps up effort to prevent cyber attacks in stock exchange platform - myRepublica

You May Have Missed

how to recover money from online scam Nepal
Awareness

How to Recover Money from Online Scam Nepal: 2026 Guide

cybersamir
By cybersamir
November 28, 2026
data leak check nepal
Awareness

How to Check If Your Data Was Leaked (Nepal 2026 Guide)

cybersamir
By cybersamir
November 26, 2026
Cinematic PHP programming thumbnail with the headline “Is PHP Dead? 2026 Reckoning,” a glowing blue PHP elephant, and CyberSamir branding.
Awareness

Is PHP Dead? A 2026 Reckoning

cybersamir
By cybersamir
October 25, 2026
ctf top 10 selected teams
News

Nepal Cyber Shield CTF: Top 10 Teams Qualified for the Grand Finale

cybersamir
By cybersamir
October 4, 2026
How to report cybercrime in Nepal Cyber Bureau complaint guide
Awareness

How to Report Cybercrime in Nepal: Step-by-Step Guide (2026)

cybersamir
By cybersamir
September 27, 2026
Nepal Data Breach: 462,600 Citizens' IDs Allegedly Leaked," subtext "Dark web forum post claims mass PII theft from a .gov.np portal
News

Nepal Government Portal Allegedly Breached: 462,600 Citizens’ Data Reportedly Listed for Sale on Dark Web

cybersamir
By cybersamir
September 24, 2026
Cybersecurity

Top 10 Security Mistakes Nepali Websites Still Make in 2026

cybersamir
By cybersamir
September 23, 2026
News Cybersecurity

Nepal Data Hub Ransomware Attack: NEPSE Shutdown Explained

cybersamir
By cybersamir
September 23, 2026
News

Nepal Cyber Shield 2026: Everything You Need to Know About Nepal’s National CTF Championship

cybersamir
By cybersamir
September 19, 2026
CS

CYBERSAMIR

Explore. Hack. Secure. Learn.

About Us

CyberSamir provides cutting-edge insights into ethical hacking, penetration testing, and cybersecurity defense strategies for professionals and enthusiasts alike.

500+ Articles
15K+ Members
30+ Tools

Resources

  • Tutorials
  • Our Services
  • Tools
  • CTF Walkthroughs
  • Security News

Community

  • WhatsApp Group
  • Discord Server
  • Telegram Group
  • Upcoming Events
  • Certifications

Follow Us

Cyber Security Events Worldwide

© CyberSamir. All Rights Reserved.

Copyright 2026 — Cyber Samir. All rights reserved. Blogsy WordPress Theme