Open redirects after login or OAuth callbacks
Last updated October 18, 2026
Steps
- Find post-login and OAuth callback handlers that read next, return_to, redirect, redirect_uri, or url from the query string.
- On your own app, try a callback with an absolute external URL and a protocol-relative //example.com target. Confirm the app does not forward the browser there.
- Allow only relative in-app paths from a fixed list, or absolute URLs whose host matches an exact allowlist—parsed with a real URL parser, not startsWith or contains.
- For OAuth, register exact redirect_uri values with the provider and compare byte-for-byte. Send the same redirect_uri to the token endpoint. Use the state parameter bound to the user session (and PKCE for public clients).
- Remove leftover /go?url= or marketing redirect endpoints that forward arbitrary URLs.
- If you must send users off-site, show an interstitial that displays the full destination before they continue.
Why it matters
PortSwigger's OAuth guidance says providers should whitelist redirect_uris with strict exact matching, and clients should send redirect_uri to both authorize and token endpoints and use state. OWASP documents how an open redirect on your domain can be chained to steal OAuth authorization codes when redirect_uri checks are too loose.
Sources
PortSwigger Web Security Academy: How to prevent OAuth authentication vulnerabilities — https://portswigger.net/web-security/oauth/preventing
OWASP: Open Redirect — https://community.owasp.org/attacks/open_redirect
Related patterns
Want an expert to check your app?
VibeRescue checks are coming soon. Join the waitlist — we only check apps you own, after verification. No scanning product is live yet.
Join the waitlistVibe Security Weekly
One email a week with new failure patterns and how to fix them.
Free. Unsubscribe anytime. We'll never sell your email.