What Is an Open Redirect Vulnerability?
An open redirect allows attackers to use your domain as a trusted-looking gateway to malicious sites. This guide explains the vulnerability, its impact and how to prevent it.
ProfitTool Team
Security & Dev
What an Open Redirect Is
An open redirect is a URL parameter on your site that redirects users to any external URL without validation:
https://yoursite.com/redirect?next=https://evil.com/phishingIf your server issues a 302 redirect to whatever URL is in next=, an attacker can craft links that start on your trusted domain but end on a malicious site.
Why Attackers Use Open Redirects
- Phishing: victims see a URL from a trusted, recognisable domain before the redirect
- OAuth abuse: some OAuth flows accept redirect_uri from the same domain — an open redirect can redirect tokens to attacker-controlled endpoints
- SSRF bypass: some SSRF filters block direct attacker URLs but allow redirects from trusted domains
- Reputation laundering: spam filters are less likely to flag links to trusted domains
Real-World Example
https://accounts.google.com/ServiceLogin?continue=https://evil.com(Google does validate its continue parameter — this is an example of the pattern, not a current vulnerability.)
Prevention
- Avoid redirecting to user-supplied URLs entirely when possible
- Use an allowlist: only redirect to known, trusted domains or paths
- Validate the URL: strip scheme, check against allowed origins
- Use relative paths:
/dashboardinstead ofhttps://yoursite.com/dashboard - Display a warning page: "You are leaving our site, click to continue" for unavoidable external redirects
- Reject URLs with unexpected schemes: block
javascript:,data:,vbscript:
In the Context of SSRF
Open redirects in internal services can be chained with SSRF to bypass IP-based blocklists. The SSRF payload points to a trusted server that then redirects to the internal target. Always re-validate the destination after following redirects.
ProfitTool Team
Security & DevWritten and maintained by the ProfitTool team. Where an article references a ProfitTool utility, the behaviour described is the behaviour of the tool on this site — you can open it and check the output yourself.
More from the Knowledge Hub
Content Security Policy (CSP) Explained: How to Prevent XSS
A CSP header tells the browser which scripts, styles and resources it may load, which is what blunts XSS. Directives, nonces, and how to roll one out safely.
Privacy & SecurityHow to Check SSL Certificate Expiry: 5 Methods
An expired SSL certificate blocks all users with a hard browser warning. Here are five ways to check certificate expiry before it becomes a problem.
Privacy & SecurityHow to Read and Analyse Email Headers
Email headers contain a complete trace of every server an email passed through. This guide explains how to find headers in major email clients, what to look for, and how to detect spoofing.