Open Redirect Explained: The Small Bug That Powers Big Phishing Attacks


You’ve seen the pattern a hundred times: you click a link on a trusted website, and it bounces you somewhere else first — example.com/redirect?url=https://other-site.com. That bounce is usually harmless. But when a site lets anyone choose the destination, attackers get a phishing weapon wearing a trusted domain’s clothes. That’s an open redirect.

How It Works

Many sites redirect users after login, logout, or clicking an external link. The destination often comes from a URL parameter:

https://trusted-site.com/login?next=https://trusted-site.com/dashboard

If the server doesn’t check that next value, an attacker can swap it:

https://trusted-site.com/login?next=https://evil-login-copy.com

Now the victim clicks a link that starts with a domain they trust — trusted-site.com — and lands on a perfect copy of the login page. The browser’s address bar even showed the trusted domain for a moment. That split-second of trust is all phishing needs.

Why Hunters Care

Open redirects rarely pay much on their own — most programs rate them low severity. But they chain beautifully. A redirect that lands on a JavaScript URL (javascript:alert(1)) can become XSS. A redirect combined with OAuth’s redirect_uri can steal tokens. And in phishing campaigns, a trusted-domain redirect is the difference between a link people click and one they ignore. Knowing this bug teaches you how small flaws become big attacks.

How to Find One (Legally)

Only test sites you own or that have a public bug bounty program with this bug in scope. Then:

  1. Find redirect parameters. Look for url, next, redirect, return, target, dest or continue in URLs — especially after login and logout.
  2. Swap the value. Replace it with https://example.com and see if the site sends you there. If it does, you have an open redirect.
  3. Try bypasses. Many sites block obvious external URLs but miss tricks:
  4. Check the impact. Can it redirect to javascript: URLs? Does it work on the login flow where victims are most trusting? Document exactly that.

How to Fix It (For Developers)

  • Allowlist destinations. Only redirect to URLs on your own domain, or to a short list of approved partners. Reject everything else.
  • Use relative paths, not full URLs. If the redirect only ever needs to go to /dashboard, accept only paths starting with / — and reject // at the start.
  • Validate after decoding. Attackers encode their payloads. Decode the parameter first, then validate — or the check sees something different from what the browser follows.
  • Don’t rely on a warning page. An interstitial “you’re leaving our site” page helps, but users click through warnings. Fix the validation instead.

How to Protect Yourself (As a User)

  • Check the final URL, not the first one. A link starting with a trusted domain can still end on a malicious site. Look at where you actually landed before typing a password.
  • Bookmark login pages. Never log in through a link that arrived in an email or message — go to the site directly.
  • Use a password manager. It only autofills credentials on the real domain, so a fake login page stays empty — a silent warning that something is wrong.

Open redirect is a small bug with an outsized lesson: trust is the real vulnerability, and attackers borrow it from the sites you already believe in.

Comments

Popular Posts