The safest approach is to avoid user-controlled redirect targets entirely. If post-login navigation is needed, restrict redirects to known internal paths or validate them against a strict allowlist. Teams should also treat redirect parameters as untrusted input, because even a trusted login page can become a phishing bridge when it sends users to an attacker-controlled domain after authentication.
How Open Redirects Turn Authentication Into a Trust Problem
open redirect flaws are dangerous in login and recovery flows because they let an attacker shape where the user goes after a high-trust action. That turns an otherwise legitimate session transition into a phishing opportunity, a token leakage risk, or a route into a counterfeit recovery page. The main security issue is not the redirect itself, but the trust users place in the authenticated journey.
Teams usually underestimate how much credibility the login origin lends to the destination. If a recovery email, password reset screen, or post-sign-in landing page can send users off-site, the redirect becomes part of the attack surface. This is especially important when the flow contains one-time links, password resets, or account-verification steps, because those moments already carry user attention and trust. In practice, teams discover the problem after users report a “real” login page that was only a bridge to something else.
How It Works in Practice
The safest design is to remove user-controlled destination URLs from the flow entirely. Instead of accepting a full redirect target, teams should send users only to known internal paths, such as a fixed dashboard, account page, or recovery completion screen. If product requirements demand variable navigation, the redirect logic should compare the target against a strict allowlist of approved relative paths or route names, not arbitrary domains or full URLs.
- Use relative paths rather than full URLs wherever possible.
- Reject absolute URLs, protocol-relative URLs, and mixed encodings that can hide an external destination.
- Validate the target before redirecting, then canonicalise it so that double-encoding or delimiter tricks do not bypass checks.
- Keep recovery links and post-auth redirects separate, so a recovery token does not also control navigation.
- Log blocked redirect attempts to detect phishing probes, testing, or user enumeration activity.
For login and recovery flows, validation has to happen server-side, because client-side checks are easy to bypass and do not protect the server’s redirect decision. Teams should also treat “return to where you were” logic carefully, because preserving user intent is a common way to smuggle in attacker-chosen destinations if the original value is not tightly constrained. Open redirect prevention is strongest when the application owns the destination list instead of trying to cleanse arbitrary input after the fact.
These controls tend to break down when legacy applications must preserve long redirect parameters across multiple hops, because intermediate encoding and forwarding layers can reintroduce unsafe destinations.
Common Variations and Edge Cases
Tighter redirect control often increases product friction, so teams need to balance user convenience against abuse resistance. The biggest edge case is callback-style behaviour, where multiple applications, identity providers, or recovery portals all need to hand off to one another. In those environments, a simple string check is rarely enough, because an apparently internal URL can still become unsafe after decoding, path normalisation, or tenant-specific routing.
Common variants include mobile app deep links, locale-specific landing pages, and third-party identity handoffs. Those patterns are acceptable only when the destination set is fixed in advance and tested against the exact deployment model. Where teams rely on signed state or transaction IDs to preserve the original request, the state should be bound to an internal route or route identifier, not to an arbitrary destination supplied by the browser.
There is no universal standard for every redirect pattern, but the practical rule is consistent: if the application cannot prove the destination is expected, local, and safe for that specific flow, it should not redirect there. That becomes especially important in password reset and account recovery, where a single unsafe hop can undo the trust the flow is meant to establish.
Risk and Threat Considerations
Open redirects in authentication and recovery flows create a direct phishing and session-abuse path. The flaw matters because users trust the originating site, so an attacker can weaponise that trust to deliver a convincing follow-on page, harvest credentials, or steer a victim into approving an action outside the intended boundary.
Failure mechanism: The attack succeeds when the application reflects an untrusted redirect target after login or recovery, often through parameters such as return, next, url, or continue. Once the victim completes a trusted step, the application forwards them to an attacker-controlled location, sometimes with enough context to make the destination look legitimate.
Impact: The result can be credential theft, recovery-token abuse, session confusion, or the loss of user confidence in the whole authentication journey. In recovery flows, the impact is often worse because users are already following instructions that appear authoritative.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 address the attack and risk surface, while CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-01 — Redirect and Callback Safety | Redirect targets in login flows can leak trust and credentials. |
| Recommendation — Restrict post-auth redirects to allowlisted internal paths and reject untrusted callback targets. | ||
| CIS Controls v8 | CIS 6 — Access Control Management | Open redirects can undermine trusted access paths after sign-in. |
| Recommendation — Enforce approved destinations and block unsafe redirect parameters in authentication flows. | ||
Practitioner Guidance
What to prioritise: Remove free-form redirect targets from login and recovery flows first, then replace them with a small set of known internal destinations. If product owners insist on flexibility, treat that as a security requirement, not a usability preference, and design the allowlist before implementation starts.
What to verify: Test the full path, not just the obvious parameter value. Verify that absolute URLs, encoded characters, nested redirects, and cross-domain callbacks are rejected consistently after server-side normalisation. Also confirm that the recovery flow cannot be used to send a user to a site that would never be permitted from the login flow.
Decision rule: If a redirect value can change the destination after a trust-establishing event, it should be considered attacker-controlled unless the application can prove otherwise. If the flow cannot make that proof reliably, the safest answer is to discard the supplied destination and route to a fixed internal page.
Practitioner takeaway: The key design choice is not whether redirects are convenient, but whether the application or the user controls the trust boundary after authentication. If the user controls it, the flow is already one step closer to phishing.
Related resources from NHI Mgmt Group
- How should security teams prevent login CSRF in SSO and OAuth flows?
- How should security teams prevent passkey enrollment abuse in federated login flows?
- How should security teams prevent open redirect vulnerabilities in modern API and OAuth-driven applications?
- How should security teams secure OAuth login flows that rely on redirect handling in multi-application environments?