An open redirect can make a trusted website appear to endorse an unsafe destination. This practical checklist explains how to identify unsafe URL forwarding, test it responsibly, distinguish it from legitimate redirects, and fix the underlying validation or configuration problem.
Overview
An open redirect vulnerability occurs when an application accepts a destination from a user-controlled input and forwards the visitor to an arbitrary external URL. A common pattern is a link such as https://example.co.uk/redirect?next=https%3A%2F%2Fother-site.example. If the application forwards to any value supplied in next, an attacker may be able to place the trusted domain in a phishing link while sending the visitor elsewhere.
This is different from an intentional website redirect. A domain forwarding rule, a post-login return URL, a campaign link, or a short link service may have a legitimate purpose. The security question is whether the destination is controlled by the application owner and constrained by clear rules, or whether any external party can choose it.
Open redirects can support phishing, obscure the final destination in messages or search results, and weaken trust in links from a recognised domain. They may also appear in several layers: application code, a CMS plugin, a reverse proxy, a link-tracking service, or a hosting control panel. Review the complete forwarding path rather than assuming that a redirect with a familiar status code is safe.
For background on implementation choices, see Apache, Nginx, Cloudflare, and WordPress redirects. For migration work, keep open-redirect checks separate from a normal website redirect map: a migration map records approved old-to-new paths, whereas an open-redirect review tests whether unapproved destinations can be introduced.
Checklist by scenario
Application return links
- List parameters such as
next,url,return,returnTo,continue, andredirect_uri. - Trace where each value is accepted, decoded, parsed, stored, and used.
- Decide whether the application needs an external destination at all. If not, accept only an internal path such as
/account, not a complete URL. - Test approved internal paths, an unapproved external origin, a malformed URL, and an empty value in a non-production environment or with explicit authorisation.
Login and authentication flows
- Use a registered set of callback or return addresses rather than accepting arbitrary destinations from the browser.
- Match the complete expected origin and path where practical. Avoid relying on a loose suffix check such as “ends with trusted-domain.example”.
- Check whether redirects occur before authentication, after logout, after password reset, or after an error. Each stage may use different code.
- Confirm that validation happens after decoding and normalisation, while preserving the intended security decision.
CMS, plugins, and redirect services
- Review redirect rules, link shorteners, tracking links, QR destinations, and administrator-configurable forwarding fields.
- Prefer a named destination or an internal record ID over a free-text URL. The server can then resolve the ID to an approved destination.
- Check who can create or edit forwarding rules, and whether deleted or expired links continue to redirect.
- Inspect both the public redirect endpoint and any preview, analytics, or API endpoint that accepts the same destination.
Domain and server configuration
- Review Apache, Nginx, CDN, and hosting-panel rules for variable-based redirects.
- Confirm that catch-all rules do not copy a query-string value into a
Locationheader without validation. - Separate fixed HTTP-to-HTTPS, www-to-non-www, and old-domain-to-new-domain rules from user-controlled forwarding logic.
- Use a redirect checker to record the full chain, status codes, and final host. A short chain does not prove that the destination is authorised.
What to double-check
Validation should reflect the business requirement. The safest pattern is an allow-list of destinations or destination identifiers. For example, a service might accept /offers and /support/contact, then reject values containing a scheme, a host, or a network-path prefix. If external destinations are required, store approved origins in configuration or a database and compare parsed URL components, including scheme, hostname, port, and where relevant, path.
Do not treat string operations as URL validation. A check for a trusted word can be bypassed by a lookalike hostname, a user-info section, altered casing, an unexpected port, or parsing differences between components. Values such as https://trusted.example.attacker.example and https://trusted.example@attacker.example illustrate why the actual hostname must be obtained from a standards-aware URL parser and compared exactly against the approved value.
Check encoding and normalisation boundaries. A value may be percent-encoded once, decoded twice, represented with a backslash, or transformed by a framework before the redirect decision. Test the value as the application receives it and as the browser ultimately interprets it. Also check whether a proxy or CDN rewrites the request before the application validates it.
Review the response itself. A server-side redirect normally returns a Location header with a 3xx status. Confirm that the header cannot be influenced by untrusted line breaks or response-header injection, and that error handling does not redirect users to an unsafe fallback. A failed validation should lead to a safe local page, a clear error, or a fixed destination.
Record each test in a small table: endpoint, input, expected result, actual result, final URL, owner, and remediation status. Retest after code, plugin, CDN, or redirect-rule changes. For related status-code checks, see the guide to 301 versus 302 redirects; status choice affects caching and SEO, but it does not make an open destination safe.
Common mistakes
- Allowing every external URL: A redirect endpoint should not become a general-purpose proxy unless that behaviour is explicitly designed, controlled, and reviewed.
- Using a partial hostname match: Compare parsed hostnames and approved origins, not an arbitrary substring.
- Validating only the visible link: Inspect API requests, form submissions, cookies, stored redirect records, and alternative parameter names.
- Trusting a 301 or 302: Both can forward to an unsafe destination. The status code describes redirect behaviour, not destination trust.
- Fixing only the front end: Client-side checks can improve usability but do not protect an endpoint. Enforce the rule on the server or at the controlled redirect layer.
- Replacing the endpoint without reviewing callers: Old campaign links, QR codes, email templates, and integrations may still use the vulnerable route. Change them deliberately and monitor for failed or unexpected traffic.
- Creating a redirect chain during remediation: Point the old route directly to the approved destination where possible. Use the redirect chain and loop troubleshooting guide to verify the result.
When to revisit
Recheck redirect security before a major release, login-flow change, domain migration, seasonal campaign, or new tracking integration. Include it when adding a short-link or QR-code feature, installing a CMS redirect plugin, changing CDN rules, or moving between hosting platforms. It is also worth reviewing after a penetration test, a phishing report, an unexpected redirect-chain alert, or a change to URL parsing libraries and framework behaviour.
Keep a current inventory of redirect endpoints and owners. During each review, run the approved test cases, add new parameters discovered in logs or code search, confirm allow-lists, and inspect the final destination in a browser and an HTTP client. Close the review only when the unsafe case is rejected, the safe case still works, and the change has been tested across the environments that can issue the redirect.
Action checklist: inventory redirect inputs; classify each destination as internal, allow-listed external, or unnecessary; replace free-form URLs with fixed routes or destination IDs where possible; validate parsed URL components server-side; test encoded and malformed values; check the complete redirect chain; document the owner; and schedule the next review when the workflow or tool changes.