Skip to content

Commit 5303214

Browse files
authored
Merge pull request #3546 from sbwalker/dev
security improvement - ensure returnurl is a relativre path
2 parents 43eae40 + 3c76335 commit 5303214

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Oqtane.Client/UI/SiteRouter.razor

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,18 @@
105105
Route route = new Route(_absoluteUri, SiteState.Alias.Path);
106106
int moduleid = (int.TryParse(route.ModuleId, out moduleid)) ? moduleid : -1;
107107
var action = (!string.IsNullOrEmpty(route.Action)) ? route.Action : Constants.DefaultAction;
108+
108109
var querystring = Utilities.ParseQueryString(route.Query);
109110
var returnurl = "";
110111
if (querystring.ContainsKey("returnurl"))
111112
{
112113
returnurl = WebUtility.UrlDecode(querystring["returnurl"]);
114+
if (!returnurl.StartsWith("/"))
115+
{
116+
// urls which are not relative are vulnerable to open redirects or XSS
117+
returnurl = "";
118+
querystring["returnurl"] = "";
119+
}
113120
}
114121

115122
// reload the client application from the server if there is a forced reload

0 commit comments

Comments
 (0)