d4Rk's 1337 h4x0r guide
  • Introduction
  • Reconnaissance
    • Recon
    • OSINT
  • Enumeration
    • Network discovery
    • Port scanning
    • Webserver scanning
    • Exploit detection
    • Fuzzing
    • Process monitoring
  • Exploitation
    • Shells
      • Shells
      • TTY
    • Passwords
      • Hashcat
      • John the Ripper (JTR)
      • Hydra
      • Passwords & credentials
    • Web
      • SQL injection (SQLi)
      • Cross site scripting (XSS)
      • File inclusions (LFI, RFI)
      • Directory traversal
      • Cross site request forgery (CSRF)
      • XML external entity (XXE)
      • Cross origin resource sharing (CORS)
      • Server-side request forgery (SSRF)
      • Server-side template injection (SSTI)
      • Access control vulnerabilities
      • Authentication vulnerabilities
      • JWT attacks
      • File uploads
      • Host header attacks
      • Clickjacking
      • Logic flaws
      • OS command injection
      • HTTP Request smuggling
      • Insecure deserialization
      • DOM-based
      • WebSockets
      • Web cache poisoning
    • Buffer overflow
      • General
      • Linux
      • Windows
    • Misc
      • Evasion
      • SQSH
  • Privilege escalation
    • Linux
      • Overview
    • Windows
      • Overview
      • Mimikatz
      • PowerSploit
      • Juicy Potato, Rotten Potato (NG)
      • JAWS
      • Empire
      • SILENTTRINITY
  • Post exploitation
    • Loot
    • Pivoting
    • Standalone Tools
  • Services
    • TCP
      • TCP 21: FTP
      • TCP 22: SSH
      • TCP 23: Telnet
      • TCP 25, 587: SMTP
      • TCP 53: DNS
      • TCP 80, 443: HTTP(S)
      • TCP 88: Kerberos
      • TCP 110, 995: POP3(S)
      • TCP 111: rpcbind
      • TCP 135: MSRPC
      • TCP 139, 445: NetBIOS, SMB
      • TCP 143, 993: IMAP(S)
      • TCP 389, 636, 3268, 3269: LDAP
      • TCP 1433, UDP 1434: MSSQL Server
      • TCP 2049: NFS
      • TCP 3306: MySQL
      • TCP 3389: RDP
      • TCP 5985: WinRM
      • TCP 6379: Redis
      • TCP 27017: MongoDB
    • UDP
      • UDP 137, 138, TCP 139: NetBIOS
      • UDP 161: SNMP
    • Misc
      • Active Directoy
      • Apache Tomcat
      • Drupal
      • H2 Databases
      • IIS
      • IPsec
      • IRC
      • Java Applets
      • Java RMI
      • Jenkins
      • Joomla
      • Oracle
      • PHP
      • SharePoint
      • WordPress
  • File transfer
    • Overview
    • Wget
    • Pure-FTPd
    • TFTP
    • VBScript: Wget clone
  • Misc
    • Bash
    • Burp Suite
    • Crypto
    • Ebowla
    • Firefox extensions
    • Impacket
    • Memory forensics
    • Metasploit Framework (MSF)
    • MITM
    • Msfvenom
    • Pass the Hash (PTH)
    • PowerShell
    • PowerShell on Linux
    • Wireshark
    • Wordlists and dictionaries
  • Bug Bounty
    • Platforms
    • Tools
Powered by GitBook
On this page
  • Probing
  • Arbitrary host header
  • Check for flawed validation
  • Ambigious requests
  • Host override headers
  • Exploitation
  • Password reset poisoning
  • Web cache poisoning
  • Access control
  • Routing-based SSRF
  • SSRF via a malformed request line
Edit on GitHub
  1. Exploitation
  2. Web

Host header attacks

PreviousFile uploadsNextClickjacking

Last updated 3 years ago

Heavily inspired by

Probing

Arbitrary host header

Send an arbitrary host header and see if you can still reach the app

Check for flawed validation

If port is not checked, and non-numeric port can be supplied

GET /path HTTP/1.1
Host: website.com:<bad-stuff-here>

If subdomains are not checked properly Register a domain that ends with the same name as the target one

GET /path HTTP/1.1
Host: <another>website.com

Already compromised subdomain

GET /path HTTP/1.1
Host: <compromised>.website.com

Ambigious requests

If the different components of the app use different validation logic, you may be able to exploit that.

Duplicate host headers

GET /path HTTP/1.1
Host: website.com
Host: <bad-stuff-here>

Line wrappings (if just duplicating the host header gets blocked, try to indent one)

GET /path HTTP/1.1
    Host: <bad-stuff-here>
Host: website.com

Absolute URL

GET https://website.com/path HTTP/1.1
Host: <bad-stuff-here>

Host override headers

Using X-Forwarded-Host, X-Host, X-Forwarded-Server, X-HTTP-Host-Override or Forwarded header

GET /path HTTP/1.1
Host: website.com
X-Forwarded-Host: <bad-stuff-here>

Exploitation

Password reset poisoning

Manipulate a website into generating a password reset link pointing to a domain under the your control

  1. Ensure Burp is enabled (to record the http history)

  2. Do the whole password reset procedure once with your own account

  3. Check Burp's HTTP history and look for the request, that triggered the reset, send to Repeater

  4. Change the Host header* and resend the request

  5. Check if the password reset still works, and if the reset link in the email contains the modified host

* If you can't change the Host header, try other stuff like using X-Forwarded-Host header to inject your host. (see above)

Web cache poisoning

Normally reflected Host headers are not exploitable, but when they're returned in a cached response, we may be able to leverage this for client side attacks like XSS.

  1. Try to observe differences between initial and further (cached) requests, use a "cache buster" like appending a get parameter (e.g. ?asdf=1) to get a fresh, uncached request, just change the the param.

  2. See if any of the above vulnerabilities can be used in a cached response (and therefore enable you to target other users, e.g. using XSS)

Access control

If the Host header is used for access control, e.g. using localhost to access an admin panel, this may be exploited, by just changing the Host header accordingly and get access.

Routing-based SSRF

Using Burp Collaborator, placing it's url into the Host header, you can check if the app reaches out to it. If so, in the next step you can use private IP addresses in the Host header to try to access internal-only systems. If you don't already have discovered private internal IP addresses, you can try to brute-force standard private IP ranges using e.g. Burp Intruder.

SSRF via a malformed request line

For more:

See also

See also

See also

See also

See also

PortSwigger - Web Security Academy - Host header
PortSwigger - Web Security Academy - Request smuggling
PortSwigger - Web Security Academy - Host header
PortSwigger - Web Security Academy - Password reset poisoning
PortSwigger - Web Security Academy - Web cache poisoning via the Host header
PortSwigger - Web Security Academy - Accessing restricted functionality
PortSwigger - Web Security Academy - Routing-based SSRF
PortSwigger - Web Security Academy - SSRF via a malformed request line