asp.net存在安全隐患,即攻击者可以利用潜在的canonicalization攻击webserver
(即利用 ..\.. 欺骗 IIS,从而遍历目录),建议在Global.asax.cs中加入如下代码提高安全性:
<script language="C#" runat="server">
void Application_BeginRequest(object source, EventArgs e) {
    if (Request.Path.IndexOf('\\') >= 0 ||
        System.IO.Path.GetFullPath(Request.PhysicalPath) != Request.PhysicalPath) {
        throw new HttpException(404, "not found");
    }
}
</script>

相关文章:

  • 2021-07-30
  • 2022-12-23
  • 2022-02-25
  • 2021-07-28
  • 2021-05-16
  • 2021-04-06
  • 2021-04-27
  • 2021-12-03
猜你喜欢
  • 2021-11-08
  • 2021-10-09
  • 2022-12-23
  • 2021-06-13
  • 2021-12-15
相关资源
相似解决方案