IIS代字号漏洞问题

时间:2012-08-14 08:52:40

标签: asp.net security iis url-rewriting

以下是我们网站上的问题:

使用Windows文件系统速记字符和状态返回代码强制执行文件/目录名称

It is possible to find an unknown filename up to six characters by using shorthand file characters such as ~1 and
    *Example: site.com/admin/uplo*~1*/.aspx
This attack relies on reading different error codes the webserver responds with when the file(s) exist or not. Let’s say the file upload.aspx exists in the directory admin. Our attacks responses would look like this:
    site.com/admin/uplo*~1*/.aspx – IIS returns HTTP 404 File Not Found (valid file)
    site.com/admin/uplp*~1*/.aspx – IIS returns HTTP 400 Bad Request (invalid file)
        *Note that IIS 7.x responds with different error codes (0×0 when valid) instead of http status codes

更多细节 http://www.alertlogic.com/internet-information-server-iis-exploitation-2/

可能的解决方案之一: ...  如果可能,您可能希望使用URL重写来禁止任何带有波浪号字符的URL被接受 ...

问题: 怎么做?在URL重写规则中应该使用什么正则表达式以丢弃网站上所有URL中的〜字符(ASP.NET 3.5)

2 个答案:

答案 0 :(得分:7)

可以通过执行以下任一操作来解决此问题:

1. Install .NET 4.0 on the web server. 

OR

2. Install and configure IIS URLScan module (do not allow ~ chars in the URL by adding ~ to [DenyUrlSequences] section).

在此处查找更多有用的信息: http://weblogs.asp.net/scottgu/archive/2010/09/18/important-asp-net-security-vulnerability.aspx

答案 1 :(得分:1)

需要在IIS上禁用8.3文件名生成。简单的注册表更改,但您需要复制所有受影响的目录,因此需要IIS停止。

How to disable 8.3 file name creation on NTFS partitions

NtfsDisable8dot3NameCreation