打印本文 打印本文 关闭窗口 关闭窗口
ASP.NET Form Authentication安全漏洞及对策
作者:武汉SEO闵涛  文章来源:敏韬网  点击数698  更新时间:2009/4/23 10:45:04  文章录入:mintao  责任编辑:mintao

在NT-Bugtraq的邮件列表上首先报告的Security bug in .NET Forms Authentication适用于ASP.NET 1.0 (RTM, SP1, SP2, SP3)和ASP.NET 1.1 (RTM, SP1).

 

当Form Authentication被使用时,匿名用户在试图访问被保护的页面如http://localhost/WebApplication2/secret.aspx时会被redirect到登录网页如http://localhost/WebApplication2/login.aspx?ReturnUrl=%2fWebApplication2%2fsecret.aspx.

 

但是如果使用Mozilla,匿名用户可以这样未经认证就访问被保护的页面:http://localhost/WebApplication2\secret.aspx;对IE,可以使用%5C达到类似的效果:http://localhost/WebApplication2%5Csecret.aspx

 

微软在10月5日发布了What You Should Know About a Reported Vulnerability in Microsoft ASP.NET网页以提供针对此安全漏洞的对策。当前的对策主要是如KB887459所描述的那样在Global.asax或其Code-Behind中在Application_BeginRequest中增加检查

 

    if (Request.Path.IndexOf(''''\\'''') >= 0 ||
        System.IO.Path.GetFullPath(Request.PhysicalPath) != Request.PhysicalPath)
{
        throw new HttpException(404, "not found");
    }

显然每个Application都需要有这样的检查以应对此安全漏洞。微软还会提供其他的对策,请关注What You Should Know About a Reported Vulnerability in Microsoft ASP.NET网页更新。

 

对ASP.NET 2.0 Beta1,并没有此漏洞而是得到404错误。

打印本文 打印本文 关闭窗口 关闭窗口