HTTP carries hostnames in more than one place: Host, X-Forwarded-Host, X-Original-Host, absolute URLs. If the server uses one of them to choose a vhost or build a link, the client controls the destination.
A proxy forwards a host header and the application router trusts it. The attacker sends the internal hostname and reaches an admin vhost that should only be available internally.
We think the URL is the host. Headers are also host claims, and attackers can write them.
What is actually at stake?
Before touching a payload, map the assets, the actors and the boundary that is supposed to protect them. A finding only becomes a vulnerability when you can connect the failed boundary to a real asset.
Assets
- Password reset links
- OAuth redirect URIs
- Cached pages and routing decisions
- Email links and invitation tokens
Actors
- Attacker who controls the Host or forwarded header
- User who clicks a poisoned reset link
- Cache layer that stores the poisoned response
Trust boundaries
- Client header to application host
- Proxy to origin trust
- Host to absolute URL
- Host to cache key
Abuse cases
- Send Host: attacker.com to a password reset
- Use X-Forwarded-Host to poison a reset link
- Route to an internal virtual host
- Poison a cache with an attacker-controlled host
Follow the decision, not the payload
Every family has a moment where trusted data becomes an authorization, parsing or state decision. Learn to point at that moment in the request path.
- 01
Receive
The request carries Host and possibly X-Forwarded-Host, X-Forwarded-Proto or Forwarded.
- 02
Trust
The application or proxy uses the header to build absolute URLs or choose a virtual host.
- 03
Generate
A reset link, redirect or canonical URL includes the attacker-controlled hostname.
- 04
Deliver
The link is emailed, cached or returned to the user.
- 05
Exploit
The victim clicks the trusted-looking link and the token is sent to the attacker.
The password reset that pointed elsewhere
Composite case study from public host-header disclosuresA composite case based on a widely reported pattern: the reset endpoint built an absolute URL from the request Host header without validating it.
A tester sent a reset request with Host: attacker.example. The email contained a link to the attacker's domain with the victim's reset token.
Account takeover through token theft. The same primitive can poison OAuth redirects, invitation links and cached pages.
The application treated a client-supplied routing header as a trusted configuration value when generating security-sensitive URLs.
Use a configured canonical base URL, validate Host against an allowlist, strip untrusted forwarded headers at the edge, and never build security links from request headers.
Read it as a chain: discovery → failed decision → impact → fix. Then ask which link would have broken earliest.
A repeatable testing sequence
- Inspect which host-related headers the proxy forwards.
- Try Host, X-Forwarded-Host, X-Original-Host, X-Forwarded-Server and absolute URLs.
- Look for password-reset links, cache keys and vhost routing.
- Send the internal hostname and request the admin route.
Where smart people get fooled
- TLS protects the connection, not the hostname claim.
- A proxy may normalize Host but forward other headers.
- The UI URL is not the only place a hostname lives.
What would the logs show?
A control is stronger when someone can see it fail. These signals are starting points for a detection rule, not a complete SIEM use case.
- Requests with Host or forwarded headers that differ from the canonical domain
- Password reset or invitation links containing an unexpected host
- Cache entries created with an attacker-controlled hostname
- Virtual-host routing to internal services
- Multiple host values in one request
index=web sourcetype=access_combined | eval badhost=if(host!="academy.buggravity.com" AND host!="lab.buggravity.com",1,0) | where badhost=1 | stats count values(host) values(uri) by clientip | where count > 0Fix the decision, then prove it stays fixed
- Allowlist accepted hostnames and build absolute URLs from configuration.
- Do not trust forwarded host headers from untrusted clients.
- Route virtual hosts from a validated server name.
const base = `https://${request.headers.get("host")}`;
const link = `${base}/reset?token=${token}`;const base = process.env.PUBLIC_APP_URL;
if (!base || !base.startsWith("https://")) throw new Error("config");
const link = new URL("/reset", base);
link.searchParams.set("token", token);Security-sensitive URLs must come from configuration, not from the request. At the edge, overwrite or reject forwarded headers instead of passing them through.
Regression tests a reviewer would ask for
Reset link
GivenA user requests a password reset
WhenThe request carries Host: attacker.example
ThenThe email link still points to the canonical domain
Forwarded host
GivenThe proxy forwards X-Forwarded-Host
WhenThe client supplies an attacker value
ThenThe edge strips or overwrites it before the origin
OAuth redirect
GivenThe app builds a redirect URI
WhenThe Host header changes
ThenThe registered redirect URI is unchanged
Cache
GivenA page is cacheable
WhenA request with a foreign Host is made
ThenThe response is not stored under the canonical key or is rejected
What this finding is not
Strong testers kill their own findings before someone else does. These are the shortcuts that turn a real bug into a weak report — or a false alarm into a wasted escalation.
- The Host header is reflected in a debug page: reflection is not takeover; check whether it reaches a reset link, redirect or cache.
- The proxy rejects an unknown Host: test X-Forwarded-Host and alternate casing if the origin trusts it.
- The reset link uses a relative path: that is safer; look for redirects or email templates that absolutize it later.
- A cache returns the poisoned page only to the attacker: test a second client and a clean cache key.
Terms you should be able to use precisely
- Host header
- The HTTP header that identifies the requested host and virtual host.
- Forwarded header
- A proxy header such as X-Forwarded-Host that carries the original request metadata.
- Virtual host
- A server configuration that routes requests by hostname.
- Password reset poisoning
- Injecting a host into a reset link so the victim's token is sent to an attacker.
- Canonical URL
- The configured, trusted base URL for an application.
- Header smuggling
- Supplying duplicate or conflicting headers that different layers interpret differently.
Answer these without reciting a payload
Why is the Host header untrusted?
It is supplied by the client and may be manipulated unless the edge enforces a canonical host. Proxies may also pass forwarded variants.
How do you fix password reset poisoning?
Generate links from a configured canonical URL, validate the host at the edge, and strip untrusted forwarded headers.
How does host injection affect caching?
If the host is part of the content but not the cache key, one poisoned response can be served to other users.
Can you separate the mechanism from the payload?
Four questions, graded on the server. Answers and explanations are released only after you submit, and signed-in learners keep a best score.
رأس Host يأتي من العميل، فلا تبنِ عليه روابط إعادة تعيين كلمة المرور أو OAuth أو أي رابط أمني.
استخدم عنوانًا أساسيًا من الإعدادات، وارفض أي Host غير معروف على الحافة، ولا تثق بـX-Forwarded-Host. الخطر لا يتوقف عند انعكاس الاسم في الصفحة؛ القيمة الحقيقية تظهر عندما يصل الرابط المسموم إلى بريد الضحية أو إلى ذاكرة التخزين المؤقت.
Which hostname did the server use when it built this link or chose this vhost?