Open Redirect
The application redirects users to an address taken from the request without validating it, so a link to the genuine site can send users on to any other site.
| Severity | Medium |
| CVSS 3.1 | 4.3 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N Open in the calculator |
| CVSS 4.0 | 5.1 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-601: URL Redirection to Untrusted Site ('Open Redirect') |
| OWASP Top 10 | A01:2025 Broken Access Control |
| MITRE ATT&CK | T1566.002 Spearphishing Link, T1598.003 Spearphishing Link |
| Category | Input Validation |
Description
The application takes the destination of a redirect from a value in the request, commonly a parameter named something like returnUrl, next, redirect or url that is used after login or logout, and sends the browser there without checking that it belongs to the application. A link that starts on the genuine domain can therefore end on any site the attacker chooses. The redirect may be issued by the server, through a Location header or a meta refresh, or by client-side script that assigns the value to window.location, which is the DOM-based form.
Although each victim must follow the link, links that begin with the organisation's genuine domain make phishing more convincing, and an attacker can use the redirect to get past filters that allow links to that domain. In some designs the redirect also helps to steal tokens: where an OAuth or single sign-on flow accepts any address on the trusted domain, a redirect from there can pass the user's token on to the attacker. Client-side redirects that accept javascript: URLs can lead to cross-site scripting.
The weakness typically shows itself on a test when an external address placed in such a parameter is followed by the browser. Checks that only look for the application's domain somewhere in the value, or that block values starting with http, are commonly bypassed with addresses beginning // or /\, embedded credentials or alternative encodings. Burp Suite reports open redirection in reflected and DOM-based forms, and OWASP ZAP reports it as an external redirect.
Remediation
Decide redirect destinations on the server:
- Avoid taking redirect destinations from the request. Where the destination varies, pass an identifier and map it to a fixed list of destinations on the server.
- Where a return address is needed, accept only relative paths within the application: require a single leading
/, reject values beginning//or/\, and check the value after decoding. - Where external destinations are genuinely required, parse the URL with a standard parser and compare its scheme and host exactly with an allowlist, rather than searching the string.
- For client-side redirects, apply the same checks before assigning to
window.location, and allow only thehttpandhttpsschemes. - Where users must be sent to arbitrary external sites, show an intermediate page that names the destination and asks the user to continue.
Confirm the fix by repeating the original requests with external, protocol-relative and encoded destinations and checking that none redirects away from the application.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.