Open redirect in your login flow? A 3-minute test for AI-built apps
After a login redirect, many apps send you to a URL taken from the address bar, like /login?next=/dashboard. If the app does not check where next points, an attacker can send your users a link that starts on your real do
After a login redirect, many apps send you to a URL taken from the address bar, like /login?next=/dashboard. If the app does not check where next points, an attacker can send your users a link that starts on your real domain and ends on a fake one. That is an open redirect.
It does not leak data by itself. It makes phishing much more convincing, because the link starts with your real domain. It also breaks some sign-in flows that trust redirect targets.
Who is at risk
Any app with a login, logout, or "go back to where you were" redirect that reads the destination from the URL. AI tools write this pattern often because it is a few lines and it works in the demo.
The 3-minute test (your own app only)
- Find a link with a redirect parameter. Common names:
next,redirect,redirect_uri,returnTo,url,continue. - Replace the value with an outside site, for example
https://example.com. - Open the link in a private window and finish the action (sign in with a test account).
- If you land on example.com, the redirect is open.
- Also try tricky forms:
//example.com,https:example.com, and/\example.com. Some weak checks block the first form but let these through.
What to fix
-
Allow only paths on your own site. Accept values that start with a single
/and not//, and reject anything with a scheme or backslash. - Better, use an allowlist of known destinations, or store the destination server side and pass an ID instead of a URL.
-
Do not just check that the URL contains your domain.
https://example.com/?your-domain.compasses that check. - For OAuth, register exact redirect URLs with the provider and turn off wildcards.
A prompt you can paste into your AI builder
"Review every place the app redirects to a URL from a query parameter or form field. Only allow relative paths that start with a single slash, reject values that start with // or contain a scheme or backslash, and fall back to the home page otherwise. Register exact redirect URLs for OAuth, with no wildcards."
What a scanner can and cannot tell you
A visitor-side check can find some redirect parameters, but proving one is exploitable means following a real login. Run the test above on your own app before launch.
I work on ProofForge. The free scan checks what a visitor can see from the outside, and it says plainly what it could not check.
Check your own app from the outside, free. Run the free ProofForge scan on your live URL. No account needed for the first scan. It looks at your public site the way a stranger would and says pass, fail or inconclusive, so you know what is confirmed and what it could not see. One-time reports start at $9: see pricing. Building with an AI agent? There is an MCP server so it can check before it deploys.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.