How I Discovered an Open Redirect Using X-Forwarded-Host – A Bug Bounty Story with Real-World…
The /logout endpoint used the X-Forwarded-Host header to build its redirect target, so an attacker could send a victim to any domain. The server also followed the crafted redirect itself, making an outbound request to an attacker-controlled host.
During one of my routine bug hunting, I came across a redirect behavior on a /logout endpoint of a target application. What seemed like a minor redirection at first turned out to be an open redirect vulnerability influenced by the X-Forwarded-Host header.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application built the logout redirect URL from the client-supplied X-Forwarded-Host header without validating it against an allowlist.
Impact
An attacker could use the redirect for phishing, to bypass domain whitelists in OAuth flows, and the server-side follow-up could lead to SSRF if pointed at internal services.
What the attacker needed
Ability to set the X-Forwarded-Host header; victim clicks a crafted link
The fix
The redirect target should be validated against an allowlist of trusted hosts rather than taken from the X-Forwarded-Host header.
How it was found
- Find a 404 subdomain and run directory discovery against it.
- Identify a /logout directory that returns a 302 redirect.
- Intercept the request and add an X-Forwarded-Host header pointing to an external domain.
- Observe that the server redirects to that external domain.
- Replace the external domain with a Burp Collaborator payload and trigger the request.
- Check Collaborator logs for DNS resolution and an HTTP request from the server.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A redirect is when a website sends your browser to another address. Here the site trusted a header called X-Forwarded-Host, which a client can set, to decide where to send people after logout. Because the header was not checked, anyone could make the site send users to a domain they control, which is useful for phishing.
What is Open redirect?
A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.