[英]Request filtering does not work properly in IIS 10
為了防止路徑遍歷攻擊,我在請求過濾中添加了一些設置(在規則和URL 選項卡中)但它們不能正常工作。 例如,我在“拒絕字符串”和“拒絕序列”中添加“..”,但 IIS 接受它(例如 ../../css/test.txt)。 另外,我在 URL 重寫的“阻止請求規則”中添加了“ /../.* ”,但它也不起作用。
我的設置有什么問題嗎?
我試圖通過添加..
來使用請求過濾規則進行測試。 在測試時,我設置了失敗請求跟蹤規則來檢查后台發生的情況。 我注意到,當我們嘗試通過在 URL 中添加..
來瀏覽路徑時,它會將其轉換為正常的 URL。即localhost/../../css/test.txt
變為localhost/css/test.txt
。
看下面的測試結果
如果您正在尋找 URL 重寫規則來阻止路徑(文件夾/文件)訪問,那么下面的規則對我有效。
<rewrite>
<rules>
<rule name="RequestBlockingRule1" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions logicalGrouping="MatchAny">
<add input="{REQUEST_URI}" pattern="/test_folder/*" />
</conditions>
<action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied." statusDescription="You do not have permission to view this directory or page using the credentials that you supplied." />
</rule>
</rules>
</rewrite>
您可以根據您的要求修改規則。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.