Course contentsShow
← Computer Science
Lesson 2491 of 2,87255. Web SecurityFree lesson

Open Redirect Vulnerabilities

Using unvalidated redirect parameters to send users to malicious sites for phishing or credential theft.

Open Redirect Vulnerabilities

What you'll learn: How attackers exploit unvalidated redirect parameters to send unsuspecting users to malicious sites for phishing or credential theft.

What is an Open Redirect?

An open redirect occurs when a web application accepts user-controlled input to determine where to redirect users, without properly validating the destination URL. Attackers exploit this by crafting malicious links that appear legitimate (since they point to a trusted domain) but ultimately redirect victims to attacker-controlled sites.

How the Attack Works

Imagine a legitimate site https://bank.com/login?redirect=/account. After login, users are redirected to their account page. But what if an attacker modifies the URL to:

https://bank.com/login?redirect=https://evil.com/fake-login

If the application doesn't validate the redirect parameter, users who click this link—perhaps from an email—see the trusted bank.com domain in their address bar initially. After "logging in," they're silently redirected to evil.com, which looks identical to the real site and harvests their credentials.

Why It's Dangerous

Open redirects are particularly effective for phishing attacks because:

  • The initial URL contains a legitimate, trusted domain
  • Email filters and security tools may not flag the link
  • Users trust links that appear to come from known sites
  • The redirect happens transparently, often unnoticed

Real-World Scenario

An attacker sends: https://trustworthy-store.com/checkout?return_url=http://attacker.com/steal-payment

The victim clicks from an email, completes checkout on the real site, then gets redirected to a fake payment confirmation page that steals credit card details.

Prevention

Always whitelist allowed redirect destinations or validate that redirect URLs are relative paths (starting with /) rather than absolute URLs pointing to external domains.

Key Takeaway: Open redirect vulnerabilities turn trusted domains into laundering points for phishing attacks—always validate and restrict redirect parameters to prevent sending users to arbitrary external sites.