Open Redirect

An open (unvalidated) redirect (CWE-601) is a redirect whose destination is taken from user input without validating it against an allowlist, so an attacker chooses where a victim’s browser — or a server-side HTTP client — is sent next.

What it is

The broken trust boundary is who decides the next destination. An app legitimately needs to send users onward (post-login returnUrl, next, callback, logout continue, OAuth redirect_uri, error-page backURL, image/renderer fetch targets). When that destination comes from the request and is emitted into a Location header, a <meta refresh>, or a JavaScript navigation sink without being checked, the user controls it. The flaw is pure missing/weak validation — there is no injection and often no code execution — which is exactly why it is cheap to introduce and easy to overlook (Snyk).

Two forms matter:

  • Server-side — the redirect is issued by the server (302 + attacker Location), or by the back-end fetcher it drives.
  • Client-side / DOM — JavaScript reads a URL source and assigns it to location; invisible to server filters and WAFs → DOM-Based Open Redirect.

Why it matters

On its own an open redirect is low/medium — “a victim can be sent to a malicious copy of the site and not notice, since the original URL was legitimate” (Tib3rius). Its real value is as a chaining primitive; programs that reject standalone open redirects still pay when one sits on the right origin (Top bugs 2025, Vulnerability Chaining).

EscalationResultPage
Open redirect on OAuth-allowed originAuth code / token theft → one-click ATOOpen Redirect to OAuth Token Theft
Scheme control (javascript:) at a JS sinkXSS → session/ATODOM-Based Open Redirect
Redirect from allowlisted hostSSRF filter bypass → internal / cloud metadataOpen Redirect to SSRF
Location built from user input + CRLFheader injection / response splitting[[raw/tib3rius.com/web-appsec-interview-questions-5906
Trusted-domain redirectcredential phishing under a real cert[[raw/medium.com/killed-by-a-browser-revived-by-a-backslash-12926

Severity drivers: which origin the redirect lives on (an OAuth callback host or SSRF allowlist entry is worth far more than a marketing site), whether it carries a secret (code, token, Referer), and whether it grants scheme control.

How it works

Delivery. A crafted link whose host is the legitimate site; the user trusts the visible origin and follows the bounce. Server form emits Location:; HTML form uses <meta http-equiv="refresh" content="0;URL=//attacker"> (works where <script> is blocked) or an <iframe> whose child sets top.window.location cross-origin (Hunting with HTML).

Variants, each with its own page/section:

Where to find it

  • Parameters: redirect, redirect_uri, redirectTo, url, next, returnUrl/return_to, callback, continue, goto/gotoOnFail, dest, target, RelayState, backURL, path. Open-redirect-specific wordlists exist in the top-25-parameters list (top25-parameter).
  • Flows: login/logout and SSO landing pages, OAuth redirect_uri, error pages, email-link trackers, “you are leaving” interstitials, language/region switchers, trailing-slash directory redirects (Grafana’s static handler), proxy X-Forwarded-Prefix handling (Angular SSR).
  • Frameworks: Flask redirect(request.args['url']) (Snyk); PHP str_replace/manual header('Location:') instead of wp_safe_redirect() (yaamlabs); Go handlers concatenating AppSubURL+user input (Grafana); JS bundles with location.assign(param).
  • Products with a track record: Grafana, OpenAM (goto/gotoOnFail, CVE-2026-123546), FortiOS web-filter warning page (CVE-2025-31366), OAuth2-Proxy, WordPress themes, Apple/Zee/Airbnb subdomains.

How to test

  1. Enumerate redirect-ish parameters across history (waybackurls/gau) and JS bundles; a URL-valued query param is a strong signal (a bug'z life).
  2. Baseline: set the param to your domain; confirm a 302/Location or a client navigation to it.
  3. If filtered, work the Redirect Validation Bypasses families: /\host, ///host, https:host, host@attacker, attacker.com#@host, suffix/prefix gaps (host.attacker.com), IDN homograph, encoded delimiters (%2f%2f, %5c, %23, %40), duplicate params, trailing-normalization tricks. PortSwigger’s URL-validation-bypass cheat sheet generates context-aware wordlists (cheat sheet).
  4. Try scheme control at JS sinks: javascript: / data: to upgrade to XSS (Nitin Yadav).
  5. Hunt the escalation, not the redirect: is this origin on an OAuth allowlist, an SSRF allowlist, or does the redirect leak a code/token/Referer?

Checklist:

  • Every redirect parameter tested with external host, protocol-relative, backslash, @, #, encoded variants
  • Client-side sinks (location.*, window.open, <meta refresh>) reviewed in JS bundles
  • Scheme control (javascript:/data:) attempted at DOM sinks
  • OAuth: is redirect_uri exact-matched, and is the allowed origin free of redirects?
  • SSRF: does a fetcher follow redirects, and is any allowlisted host redirectable?
  • CRLF in the Location-building path

Exploitation and escalation

Open redirect is almost always a link in a chain (Microsoft MSRC). The three high-value directions:

Plus phishing (credential harvest on a trusted cert/domain), CRLF→header injection/desync (PortSwigger), and web-cache poisoning where a redirect is reflected into a cached response (Tib3rius).

Bypassing defenses

Covered in depth in Redirect Validation Bypasses. The recurring failures: //-only “relative” checks missing /\ and /// (Grafana CVE-2025-6023, Angular SSR); startsWith/substring host allowlists defeated by @ and suffix tricks (ChatGPT-Next-Web, Slack); normalization after validation (WordPress str_replace, Grafana file-vs-redirect path parsing); IDN homographs (Semrush); scheme-blind suffix checks (Casdoor). Browsers resolving /\ as // and treating userinfo before @ as non-host is the engine behind most of them (HackTricks).

Real-world cases

  • Grafana CVE-2025-4123 / 6023 / 6197 — open redirect (trailing-slash static handler; later /\ bypass of ValidateRedirectTo) chained with client-side path traversal to load attacker JS → full read SSRF via /render, and XSS → ATO; the 6023 patch gap re-opened it (Balada, OPSWAT).
  • Zee Entertainment, P1 CVSS 9.0 — signin?callback= open redirect leaked a one-time OTP code, redeemed for a ~55-day session → ATO (Josekutty Binu).
  • Airbnb, 2016 ($5,000) — Referer-driven post-login redirect + login-CSRF stole Facebook/Google tokens despite exact-match redirect URIs (masimshahzad).
  • ACSAC ‘23 — 6/16 IdPs vulnerable to redirect-URI path confusion, 10/16 to parameter pollution; weaponizes any open redirect on a client into OAuth ATO (ACM).
  • Cloudflare /cdn-cgi/image/ — image fetcher followed redirects without re-checking source allowlist; an open redirect under /cdn-cgi/access/logout?returnTo= on an allowed cloudflare.com host completed an XSS chain (SLCyber).
  • Next.js _next/image — any open redirect on a whitelisted domain turns the image optimizer into blind SSRF (Assetnote).
  • WordPress.org Openverse (H1 #3933198, CVSS 6.1) — str_replace count-arg mistake produced …wordpress.net@evil.example/, passing the SSO redirect allowlist (yaamlabs).
  • Slack (#2575) / Semrush (#861940) — redirect_uri suffix match and IDN homograph bypasses leaking OAuth code/token (Slack, Semrush).
  • OpenAM (CVE-2026-123546) — goto/gotoOnFail open redirect + XSS in the XUI (GHSA); FortiOS CVE-2025-31366 — unauth XSS + open redirect in web-filter warning page (Wiz).
  • NASA.gov — reflected XSS + open redirect under a trusted NASA cert used for a fake-SSO phishing PoC (writeup).

Prevention

  • Don’t take destinations from the request. Map an opaque key (?next=profile) to a server-side path table; redirect to the resolved value.
  • If you must accept a path, enforce relative-only: startswith("/") and not startswith("//") and reject backslashes and multiple leading slashes (collapse ^[/\\]+), or resolve against your fixed origin and compare. For hosts, exact-match an allowlist after a required delimiter, never prefix/suffix/substring; validate the scheme (http/https only).
  • Use the framework’s safe helper: wp_safe_redirect(), Django url_has_allowed_host_and_scheme, Rails redirect_to ... allow_other_host: false, Angular SSR patched prefix normalization.
  • OAuth: exact-match per-client redirect_uri, no wildcards, re-validate at the token endpoint, never sanitize the value; keep open redirects off every origin in the allowlist; Referrer-Policy: no-referrer and no third-party scripts on callback pages (ACM, Doyensec).
  • SSRF: don’t follow redirects on server fetchers, or re-validate every hop’s resolved IP (windshock).
  • Client-side: Trusted Types + CSP; validate at the sink, not only at a WAF (scheme filters fall to encoding).

Tools

  • Detection/fuzzing: OpenRedireX, Oralyzer, Injectus (CRLF+open-redirect), dom-red, NucleiFuzzer/Nuclei fuzzing templates, KNOXSS (XSS+open redirect), Wapiti redirect module (Awesome BB Tools, NucleiFuzzer, knoxnl, Wapiti).
  • Payload generation: PortSwigger URL validation bypass cheat sheet; recollapse for regex-fuzzing validators (cheat sheet).
  • SSRF chaining: hosted redirectors (r3dir.me), tinyurl, self-hosted 302 redirector (SSRF via redirects).
  • SAST: Snyk Code (symbolic AI found Flask open redirect) (Snyk).

Sub-pages

Sources