# 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 ([[raw/snyk.io/solving-security-challenges-with-snyk-code-and-symbolic-ai-9212|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" ([[raw/tib3rius.com/web-appsec-interview-questions-5906|Tib3rius]]). Its real value is as a chaining primitive; programs that reject standalone open redirects still pay when one sits on the right origin ([[raw/medium.com/top-bugs-that-actually-paid-bounties-in-2025-4666|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|Tib3rius]] |
| Trusted-domain redirect | credential phishing under a real cert | [[raw/medium.com/killed-by-a-browser-revived-by-a-backslash-12926|NASA.gov]] |
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 ([[raw/medium.com/hunting-good-bugs-with-only-html-1003|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]] ([[raw/abdelnasserr.medium.com/intent-redirection-to-one-click-account-takeover-but-it-s-a-duplicate-13028|intent redirection]], [[raw/hackingarticles.in/android-pentest-deep-link-exploitation-4019|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 ([[raw/github.com/github-lutfumertceylan-top25-parameter-for-basic-researches-top-25-vul-48|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'])` ([[raw/snyk.io/solving-security-challenges-with-snyk-code-and-symbolic-ai-9212|Snyk]]); PHP `str_replace`/manual `header('Location:')` instead of `wp_safe_redirect()` ([[raw/yaamlabs.com/bug-bounty-roundup-15-disclosed-hackerone-reports-incl-basecamp-csp-by-13721|yaamlabs]]); Go handlers concatenating `AppSubURL`+user input ([[raw/opswat.com/grafana-cve-2025-6023-full-account-takeover-4097|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 ([[raw/medium.com/exploiting-an-ssrf-trials-and-tribulations-by-a-bug-z-life-a-bug-z-lif-97|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 ([[raw/portswigger.net/url-validation-bypass-cheat-sheet-2024-edition-web-security-academy-5105|cheat sheet]]).
4. **Try scheme control** at JS sinks: `javascript:` / `data:` to upgrade to XSS ([[raw/infosecwriteups.com/the-waf-blocked-my-xss-so-i-rotated-what-it-was-reading-11713|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 ([[raw/microsoft.com/weaponizing-cross-site-scripting-when-one-bug-isn-t-enough-3111|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]] ([[raw/dl.acm.org/oauth-2-0-redirect-uri-validation-falls-short-acm-4081|ACM]]).
- **XSS** — scheme control (`javascript:`) at a client sink → [[DOM-Based Open Redirect]] ([[raw/infosecwriteups.com/chaining-a-dom-xss-sink-waf-bypass-cross-origin-smuggling-and-sdk-abus-10213|IW]]).
- **SSRF** — a server-side fetcher follows the redirect past its own URL filter → [[Open Redirect to SSRF]]. Hosted redirectors (`r3dir.me`) and `tinyurl` are used to point a filtered fetcher at `127.0.0.1`/`169.254.169.254` ([[raw/osintteam.blog/ssrf-filters-bypass-using-redirects-15192|SSRF via redirects]], [[raw/notifybugme.medium.com/aws-internal-metadata-accessed-through-ssrf-by-chaining-an-open-redire-1986|AWS metadata]]).
Plus phishing (credential harvest on a trusted cert/domain), CRLF→header injection/desync ([[raw/portswigger.net/making-http-header-injection-critical-with-one-prompt-13154|PortSwigger]]), and web-cache poisoning where a redirect is reflected into a cached response ([[raw/tib3rius.com/web-appsec-interview-questions-5906|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 ([[raw/book.hacktricks.xyz/url-format-bypass-hacktricks-43|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 ([[raw/medium.com/grafana-cve-2025-4123-full-read-ssrf-account-takeover-3235|Balada]], [[raw/opswat.com/grafana-cve-2025-6023-full-account-takeover-4097|OPSWAT]]).
- **Zee Entertainment, P1 CVSS 9.0** — `signin?callback=` open redirect leaked a one-time OTP code, redeemed for a ~55-day session → ATO ([[raw/medium.com/chaining-an-open-redirect-into-account-takeover-p1-cvss-9-0-13937|Josekutty Binu]]).
- **Airbnb, 2016 ($5,000)** — `Referer`-driven post-login redirect + login-CSRF stole Facebook/Google tokens despite exact-match redirect URIs ([[raw/masimshahzad.medium.com/the-referer-header-that-redirected-oauth-tokens-14095|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 ([[raw/dl.acm.org/oauth-2-0-redirect-uri-validation-falls-short-acm-4081|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 ([[raw/slcyber.io/cache-me-if-you-can-xss-in-cloudflare-s-cdn-cgi-image-12412|SLCyber]]).
- **Next.js `_next/image`** — any open redirect on a whitelisted domain turns the image optimizer into blind SSRF ([[raw/assetnote.io/digging-for-ssrf-in-nextjs-apps-181|Assetnote]]).
- **WordPress.org Openverse (H1 #3933198, CVSS 6.1)** — `str_replace` count-arg mistake produced `…
[email protected]/`, passing the SSO redirect allowlist ([[raw/yaamlabs.com/bug-bounty-roundup-15-disclosed-hackerone-reports-incl-basecamp-csp-by-13721|yaamlabs]]).
- **Slack (#2575) / Semrush (#861940)** — `redirect_uri` suffix match and IDN homograph bypasses leaking OAuth code/token ([[raw/hackerone.com/slack-oauth2-redirect-uri-bypass-hackerone-2575-3876|Slack]], [[raw/hackerone.com/semrush-oauth-redirect-uri-bypass-via-idn-homograph-hackerone-861940-3875|Semrush]]).
- **OpenAM (CVE-2026-123546)** — `goto`/`gotoOnFail` open redirect + XSS in the XUI ([[raw/github.com/openam-open-redirect-and-xss-before-16-1-4-13549|GHSA]]); **FortiOS CVE-2025-31366** — unauth XSS + open redirect in web-filter warning page ([[raw/wiz.io/cve-2025-31366-impact-exploitability-and-mitigation-steps-2324|Wiz]]).
- **NASA.gov** — reflected XSS + open redirect under a trusted NASA cert used for a fake-SSO phishing PoC ([[raw/medium.com/killed-by-a-browser-revived-by-a-backslash-12926|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 ([[raw/dl.acm.org/oauth-2-0-redirect-uri-validation-falls-short-acm-4081|ACM]], [[raw/blog.doyensec.com/doyensec-common-oauth-vulnerabilities-3891|Doyensec]]).
- **SSRF**: don't follow redirects on server fetchers, or re-validate every hop's resolved IP ([[raw/windshock.github.io/the-limitations-of-secure-ssrf-patches-advanced-bypasses-4199|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 ([[raw/github.com/awesome-bug-bounty-tools-2056|Awesome BB Tools]], [[raw/kitploit.com/nucleifuzzer-powerful-automation-tool-for-detecting-xss-sqli-ssrf-open-2185|NucleiFuzzer]], [[raw/github.com/github-xnl-h4ck3r-knoxnl-this-is-a-python-wrapper-around-the-amazing-k-6589|knoxnl]], [[raw/github.com/wapiti-scanner-wapiti-web-vulnerability-scanner-written-in-python3-5210|Wapiti]]).
- **Payload generation**: PortSwigger URL validation bypass cheat sheet; `recollapse` for regex-fuzzing validators ([[raw/portswigger.net/url-validation-bypass-cheat-sheet-2024-edition-web-security-academy-5105|cheat sheet]]).
- **SSRF chaining**: hosted redirectors (`r3dir.me`), `tinyurl`, self-hosted `302` redirector ([[raw/osintteam.blog/ssrf-filters-bypass-using-redirects-15192|SSRF via redirects]]).
- **SAST**: Snyk Code (symbolic AI found Flask open redirect) ([[raw/snyk.io/solving-security-challenges-with-snyk-code-and-symbolic-ai-9212|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
- [[raw/portswigger.net/url-validation-bypass-cheat-sheet-2024-edition-web-security-academy-5105|URL validation bypass cheat sheet]]
- [[raw/portswigger.net/introducing-the-url-validation-bypass-cheat-sheet-197|Introducing the URL validation bypass cheat sheet]]
- [[raw/book.hacktricks.xyz/url-format-bypass-hacktricks-43|URL Format Bypass - HackTricks]]
- [[raw/dl.acm.org/oauth-2-0-redirect-uri-validation-falls-short-acm-4081|OAuth 2.0 Redirect URI Validation Falls Short (ACM)]]
- [[raw/flex0geek.blogspot.com/what-can-i-do-with-open-redirect-with-oauth-7033|What can I do with Open Redirect with OAuth?]]
- [[raw/masimshahzad.medium.com/the-referer-header-that-redirected-oauth-tokens-14095|The Referer Header That Redirected OAuth Tokens]]
- [[raw/medium.com/chaining-an-open-redirect-into-account-takeover-p1-cvss-9-0-13937|Chaining an Open Redirect Into Account Takeover (P1 · CVSS 9.0)]]
- [[raw/medium.com/top-10-oauth-2-0-hacking-techniques-part-2-4538|Top 10 OAuth 2.0 Hacking Techniques Part 2]]
- [[raw/medium.com/oauth-vulnerabilities-part-ii-bug-bounty-2k25-4540|OAuth Vulnerabilities Part II (Bug Bounty 2k25)]]
- [[raw/portswigger.net/portswigger-oauth-2-0-authentication-vulnerabilities-3899|PortSwigger: OAuth 2.0 authentication vulnerabilities]]
- [[raw/blog.doyensec.com/doyensec-common-oauth-vulnerabilities-3891|Doyensec: Common OAuth Vulnerabilities]]
- [[raw/cobalt.io/cobalt-oauth-vulnerabilities-part-2-3889|Cobalt: OAuth Vulnerabilities Part 2]]
- [[raw/guptadeepak.com/sso-protocol-security-critical-vulnerabilities-in-saml-oauth-oidc-jwt-4718|SSO Protocol Security: SAML, OAuth, OIDC, JWT]]
- [[raw/hackerone.com/slack-oauth2-redirect-uri-bypass-hackerone-2575-3876|Slack OAuth2 redirect_uri bypass — HackerOne #2575]]
- [[raw/hackerone.com/semrush-oauth-redirect-uri-bypass-via-idn-homograph-hackerone-861940-3875|Semrush OAuth redirect_uri bypass via IDN homograph — HackerOne #861940]]
- [[raw/blog.slonser.info/why-protocol-matters-evil-pwa-attack-on-casdoor-11449|Why Protocol Matters: Evil PWA Attack on Casdoor]]
- [[raw/opswat.com/grafana-cve-2025-6023-full-account-takeover-4097|Grafana CVE-2025-6023: Full Account Takeover]]
- [[raw/medium.com/grafana-cve-2025-4123-full-read-ssrf-account-takeover-3235|Grafana CVE-2025–4123: Full Read SSRF & Account Takeover]]
- [[raw/blog.angular.dev/security-advisory-addressing-recent-vulnerabilities-in-angular-2627|Security Advisory: Recent Vulnerabilities in Angular]]
- [[raw/yaamlabs.com/bug-bounty-roundup-15-disclosed-hackerone-reports-incl-basecamp-csp-by-13721|Bug bounty roundup: 15 disclosed HackerOne reports]]
- [[raw/windshock.github.io/the-limitations-of-secure-ssrf-patches-advanced-bypasses-4199|The Limitations of 'Secure' SSRF Patches]]
- [[raw/portswigger.net/dom-based-vulnerabilities-web-security-academy-5051|DOM-based vulnerabilities | Web Security Academy]]
- [[raw/infosecwriteups.com/the-waf-blocked-my-xss-so-i-rotated-what-it-was-reading-11713|The WAF Blocked My XSS — So I Rotated What It Was Reading]]
- [[raw/infosecwriteups.com/chaining-a-dom-xss-sink-waf-bypass-cross-origin-smuggling-and-sdk-abus-10213|Chaining a DOM XSS Sink, WAF Bypass, Cross-Origin Smuggling, SDK Abuse]]
- [[raw/slcyber.io/cache-me-if-you-can-xss-in-cloudflare-s-cdn-cgi-image-12412|Cache Me If You Can: XSS in Cloudflare's /cdn-cgi/image/]]
- [[raw/blog.orange.tw/the-last-proof-of-human-craft-forging-a-microsoft-edge-full-chain-with-12423|The Last Proof of Human Craft: Forging a Microsoft Edge Full Chain]]
- [[raw/medium.com/hunting-good-bugs-with-only-html-1003|Hunting good bugs with only HTML]]
- [[raw/microsoft.com/weaponizing-cross-site-scripting-when-one-bug-isn-t-enough-3111|Weaponizing Cross Site Scripting: When One Bug Isn't Enough]]
- [[raw/tib3rius.com/web-appsec-interview-questions-5906|Web AppSec Interview Questions]]
- [[raw/osintteam.blog/ssrf-filters-bypass-using-redirects-15192|SSRF Filters Bypass Using Redirects]]
- [[raw/notifybugme.medium.com/aws-internal-metadata-accessed-through-ssrf-by-chaining-an-open-redire-1986|AWS internal metadata accessed through SSRF by Chaining an Open Redirect bug]]
- [[raw/assetnote.io/digging-for-ssrf-in-nextjs-apps-181|Digging for SSRF in NextJS apps]]
- [[raw/portswigger.net/what-is-ssrf-server-side-request-forgery-tutorial-examples-web-securit-1980|Server-side request forgery (SSRF)]]
- [[raw/github.com/openam-open-redirect-and-xss-before-16-1-4-13549|OpenAM open redirect and XSS before 16.1.4]]
- [[raw/wiz.io/cve-2025-31366-impact-exploitability-and-mitigation-steps-2324|CVE-2025-31366 Impact, Exploitability and Mitigation]]
- [[raw/bishopfox.com/submit-and-execute-weaponizing-reflected-xss-in-siemens-teamcenter-s-l-12267|Weaponizing Reflected XSS in Siemens Teamcenter's Login Redirect]]
- [[raw/medium.com/killed-by-a-browser-revived-by-a-backslash-12926|Killed by a Browser, Revived by a Backslash]]
- [[raw/snyk.io/solving-security-challenges-with-snyk-code-and-symbolic-ai-9212|Solving Security Challenges with Snyk Code and Symbolic AI]]
- [[raw/github.com/github-lutfumertceylan-top25-parameter-for-basic-researches-top-25-vul-48|top25-parameter]]
- [[raw/github.com/awesome-bug-bounty-tools-2056|Awesome Bug Bounty Tools]]
- [[raw/kitploit.com/nucleifuzzer-powerful-automation-tool-for-detecting-xss-sqli-ssrf-open-2185|NucleiFuzzer]]
- [[raw/github.com/github-xnl-h4ck3r-knoxnl-this-is-a-python-wrapper-around-the-amazing-k-6589|knoxnl]]
- [[raw/github.com/wapiti-scanner-wapiti-web-vulnerability-scanner-written-in-python3-5210|Wapiti]]
- [[raw/abdelnasserr.medium.com/intent-redirection-to-one-click-account-takeover-but-it-s-a-duplicate-13028|Intent Redirection to One-Click Account Takeover]]
- [[raw/hackingarticles.in/android-pentest-deep-link-exploitation-4019|Android Pentest: Deep Link Exploitation]]
- [[raw/portswigger.net/making-http-header-injection-critical-with-one-prompt-13154|Making HTTP header injection critical with one prompt]]
- [[raw/medium.com/exploiting-an-ssrf-trials-and-tribulations-by-a-bug-z-life-a-bug-z-lif-97|Exploiting an SSRF: Trials and Tribulations]]
- [[raw/medium.com/top-bugs-that-actually-paid-bounties-in-2025-4666|Top Bugs That Actually Paid Bounties in 2025]]