0

CAT.NET says there is a cross-site redirection vulnerability in my website. It says below code is problematic and can cause redirection attack.

this.Response.Redirect(this.Page.Request.Url.ToString());

I believe redirection attack occurs when a user controllable input exists in the URL. But in this case no user input exists in the URL.

Can anyone tell me if this is really a problem or just a false positive? If this indeed is a problem than why is that and what is the solution?

subs
  • 2,189
  • 12
  • 35
  • 59

1 Answers1

1

Cross-site redirection vulnerability happens when there's a parameter added to the request that specifies on what page the user must be redirected after that the action has been performed (usually when using forms authentication).

URL looks like this: www.mysite.com/Logon?returnURL=www.mysite.com/Logon.
The malicious action consist of replacing this parameter with a wrong URL: www.mysite.com/Logon?returnURL=www.hackerSite.com/Logon

It's quite easy to avoid that by checking if the returnURL is local with if (Url.IsLocalUrl(returnUrl))

In your case it might be a flase positive, but it's always a best practice to check the validity or the redirect URL before redirecting.

MaxSC
  • 4,698
  • 2
  • 23
  • 36