Glossary

Open Redirect

An open redirect is a vulnerability where an application redirects a user to an arbitrary external URL without validation. An attacker crafts a link like https://trusted.com/redirect?url=https://phishing.com — the victim sees a trusted domain and lands on a malicious site.

Typical use in attacks

Defence

// Check: only relative URLs
function safeRedirect(string $url): string {
  $parsed = parse_url($url);
  // reject if scheme or host is present
  if (isset($parsed['scheme']) || isset($parsed['host'])) {
    return '/'; // fallback to home
  }
  return $url;
}