简体   繁体   English

HttpUtility.UrlEncode()是否可以阻止Open Redirect攻击?

[英]Could HttpUtility.UrlEncode() prevent Open Redirect attack?

I am checking a ASP.net MVC project for the security issues. 我正在检查ASP.net MVC项目中的安全性问题。

I found some code like the following, I am wondering is UrlEncode() preventing open redirect issue? 我发现了类似以下的代码,我想知道UrlEncode()防止打开重定向问题?

public ActionResult Redirect(string url)
{
   return Redirect(HttpUtility.UrlEncode(url));
}

No,Of course not! 不,当然不!

Open Redirection is basically allowing an attacker to redirect a victim to an unsafe/malicious page because of a missing URL authentication. 开放式重定向基本上是允许攻击者由于缺少URL身份验证而将受害者重定向到不安全/恶意的页面。

Encoding the Url won't help.. At all. 编码网址无济于事。

To be able to prevent it you can see my answer on this thread: 为了防止这种情况,您可以在此线程上看到我的答案:

https://stackoverflow.com/a/48051915/7827699 https://stackoverflow.com/a/48051915/7827699

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM