Redirection Gone Wrong: How Trust and the Referer Can Be Weaponized
The web application had an open redirect where the server trusted the Referer header to decide whether to redirect to an external URL. An attacker could craft a link that causes the server to redirect victims to a malicious site, enabling phishing and other chained attacks.
While conducting a light reconnaissance on a web application, I stumbled upon something seemingly harmless:
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 server used the Referer header as an authorization check for redirects without validating the destination URL against a whitelist.
Impact
An attacker could use the trusted domain to redirect victims to malicious sites, which could facilitate phishing, session fixation, XSS/CSRF chaining, redirect loops, and data exfiltration.
What the attacker needed
Victim clicks a crafted link
The fix
The redirect destination should be validated against a whitelist, the Referer header should never be used for authorization, relative paths should be used instead of full URLs, and referers should be stripped when not needed.
How it was found
- Attacker crafts a link to the target's redirect endpoint with an external destination.
- Victim clicks the link.
- The request includes a Referer header from the target domain, which the server trusts.
- The server redirects the victim to the external site.
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.
An open redirect is a flaw where a website sends you to another site based on a link you click. Here, the site also checked the 'Referer' header, which tells where you came from, and trusted it completely. That means an attacker can make a link that looks like it goes to the trusted site but actually sends you to a fake site.
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.