How to avoid open-redirect vulnerability and safely redirect on successful login (HINT: ASP.NET MVC 2 default code is vulnerable)

前端 未结 4 2183
[愿得一人]
[愿得一人] 2021-02-04 03:06

Normally, when a site requires that you are logged in before you can access a certain page, you are taken to the login screen and after successfully authenticating yourself, you

4条回答
  •  一向
    一向 (楼主)
    2021-02-04 03:34

    As long as you use one of the variants of Redirect that uses controller and action parameters or a route name, you should be alright, provided you have adequate security controls on your controller methods.

    The concept being, whatever you use for your redirect must go through the routing engine and be validated by matching a route.

    But I suspect that the real vulnerability is Cross-Site Scripting. Unless your malicious user can inject some Javascript into the page, they have no way of manipulating the return Url, or any of its parameters (since you otherwise control all of the server and browser code).

提交回复
热议问题