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+ attackerLocation), 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).
| Escalation | Result | Page |
|---|---|---|
| Open redirect on OAuth-allowed origin | Auth code / token theft → one-click ATO | Open Redirect to OAuth Token Theft |
Scheme control (javascript:) at a JS sink | XSS → session/ATO | DOM-Based Open Redirect |
| Redirect from allowlisted host | SSRF filter bypass → internal / cloud metadata | Open Redirect to SSRF |
Location built from user input + CRLF | header injection / response splitting | [[raw/tib3rius.com/web-appsec-interview-questions-5906 |
| Trusted-domain redirect | credential 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:
- Validation defeated by parser/encoding quirks → Redirect Validation Bypasses
- Client-side source→sink flow, scheme control → DOM-Based Open Redirect
- As an OAuth proxy for code/token theft → Open Redirect to OAuth Token Theft
- As an SSRF allowlist/denylist bypass → Open Redirect to SSRF
- Mobile deep-link / intent redirection (native URL handlers that forward attacker URIs into a WebView under the app origin) → Mobile OAuth and Deep Link Attacks (intent redirection, deep links)
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), proxyX-Forwarded-Prefixhandling (Angular SSR). - Frameworks: Flask
redirect(request.args['url'])(Snyk); PHPstr_replace/manualheader('Location:')instead ofwp_safe_redirect()(yaamlabs); Go handlers concatenatingAppSubURL+user input (Grafana); JS bundles withlocation.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
- Enumerate redirect-ish parameters across history (waybackurls/gau) and JS bundles; a URL-valued query param is a strong signal (a bug'z life).
- Baseline: set the param to your domain; confirm a
302/Locationor a client navigation to it. - 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). - Try scheme control at JS sinks:
javascript:/data:to upgrade to XSS (Nitin Yadav). - 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_uriexact-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:
- OAuth token theft — the redirect proxies the code/token off the client origin, defeating exact-match
redirect_uri→ Open Redirect to OAuth Token Theft (ACM). - XSS — scheme control (
javascript:) at a client sink → DOM-Based Open Redirect (IW). - SSRF — a server-side fetcher follows the redirect past its own URL filter → Open Redirect to SSRF. Hosted redirectors (
r3dir.me) andtinyurlare used to point a filtered fetcher at127.0.0.1/169.254.169.254(SSRF via redirects, AWS metadata).
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 ofValidateRedirectTo) 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 allowedcloudflare.comhost 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_replacecount-arg mistake produced…wordpress.net@evil.example/, passing the SSO redirect allowlist (yaamlabs). - Slack (#2575) / Semrush (#861940) —
redirect_urisuffix match and IDN homograph bypasses leaking OAuth code/token (Slack, Semrush). - OpenAM (CVE-2026-123546) —
goto/gotoOnFailopen 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/httpsonly). - Use the framework’s safe helper:
wp_safe_redirect(), Djangourl_has_allowed_host_and_scheme, Railsredirect_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-referrerand 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
redirectmodule (Awesome BB Tools, NucleiFuzzer, knoxnl, Wapiti). - Payload generation: PortSwigger URL validation bypass cheat sheet;
recollapsefor regex-fuzzing validators (cheat sheet). - SSRF chaining: hosted redirectors (
r3dir.me),tinyurl, self-hosted302redirector (SSRF via redirects). - SAST: Snyk Code (symbolic AI found Flask open redirect) (Snyk).
Sub-pages
- Redirect Validation Bypasses — parser/encoding/allowlist tricks that defeat the “is this URL safe” check
- Open Redirect to OAuth Token Theft — redirect as a proxy to steal auth codes/tokens for ATO
- DOM-Based Open Redirect — client-side source→navigation-sink flows and scheme control to XSS
- Open Redirect to SSRF — redirect from an allowlisted host to bypass SSRF URL filters
Sources
- URL validation bypass cheat sheet · original
- Introducing the URL validation bypass cheat sheet · original
- URL Format Bypass - HackTricks · original
- OAuth 2.0 Redirect URI Validation Falls Short (ACM) · original
- What can I do with Open Redirect with OAuth? · original
- The Referer Header That Redirected OAuth Tokens · original
- Chaining an Open Redirect Into Account Takeover (P1 · CVSS 9.0) · original
- Top 10 OAuth 2.0 Hacking Techniques Part 2 · original
- OAuth Vulnerabilities Part II (Bug Bounty 2k25) · original
- PortSwigger: OAuth 2.0 authentication vulnerabilities · original
- Doyensec: Common OAuth Vulnerabilities · original
- Cobalt: OAuth Vulnerabilities Part 2 · original
- SSO Protocol Security: SAML, OAuth, OIDC, JWT · original
- Slack OAuth2 redirect_uri bypass — HackerOne #2575 · original
- Semrush OAuth redirect_uri bypass via IDN homograph — HackerOne #861940 · original
- Why Protocol Matters: Evil PWA Attack on Casdoor · original
- Grafana CVE-2025-6023: Full Account Takeover · original
- Grafana CVE-2025–4123: Full Read SSRF & Account Takeover · original
- Security Advisory: Recent Vulnerabilities in Angular · original
- Bug bounty roundup: 15 disclosed HackerOne reports · original
- The Limitations of 'Secure' SSRF Patches · original
- DOM-based vulnerabilities | Web Security Academy · original
- The WAF Blocked My XSS — So I Rotated What It Was Reading · original
- Chaining a DOM XSS Sink, WAF Bypass, Cross-Origin Smuggling, SDK Abuse · original
- Cache Me If You Can: XSS in Cloudflare's /cdn-cgi/image/ · original
- The Last Proof of Human Craft: Forging a Microsoft Edge Full Chain · original
- Hunting good bugs with only HTML · original
- Weaponizing Cross Site Scripting: When One Bug Isn't Enough · original
- Web AppSec Interview Questions · original
- SSRF Filters Bypass Using Redirects · original
- AWS internal metadata accessed through SSRF by Chaining an Open Redirect bug · original
- Digging for SSRF in NextJS apps · original
- Server-side request forgery (SSRF) · original
- OpenAM open redirect and XSS before 16.1.4 · original
- CVE-2025-31366 Impact, Exploitability and Mitigation · original
- Weaponizing Reflected XSS in Siemens Teamcenter's Login Redirect · original
- Killed by a Browser, Revived by a Backslash · original
- Solving Security Challenges with Snyk Code and Symbolic AI · original
- top25-parameter · original
- Awesome Bug Bounty Tools · original
- NucleiFuzzer · original
- knoxnl · original
- Wapiti · original
- Intent Redirection to One-Click Account Takeover · original
- Android Pentest: Deep Link Exploitation · original
- Making HTTP header injection critical with one prompt · original
- Exploiting an SSRF: Trials and Tribulations · original
- Top Bugs That Actually Paid Bounties in 2025 · original