加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 禁止在URL中使用/的IIS 403

发布时间:2020-12-15 04:44:51 所属栏目:Java 来源:网络整理
导读:我有IIS(Microsoft-IIS / 7.5)返回403禁止,我无法弄清楚为什么.我把它缩小到/但只有当它前面有一个字母时.知道是什么原因引起的吗? 这些工作…… http://example.com/mySite123/index.cfm?x=blah%2Fblah http://example.com/mySite123/index.cfm?x=blah%2F
我有IIS(Microsoft-IIS / 7.5)返回403禁止,我无法弄清楚为什么.我把它缩小到/但只有当它前面有一个字母时.知道是什么原因引起的吗?

这些工作……

> http://example.com/mySite123/index.cfm?x=blah%2Fblah
> http://example.com/mySite123/index.cfm?x=blah%2F
> http://example.com/mySite123/index.cfm?x=123%2F
> http://example.com/mySite123/index.cfm?x=%2F

但是如果你把任何一个字母放在/前面就失败了403.

这些失败……

> http://example.com/mySite123/index.cfm?x=a%2F
> http://example.com/mySite123/index.cfm?x=b%2F
> http://example.com/mySite123/index.cfm?x=c%2F
> ……
> http://example.com/mySite123/index.cfm?x=z%2F
> http://example.com/mySite123/anything.anything?anything=x%2Fanything

谢谢!

更新:我排除了ColdFusion,因为这给出了相同的403:http://example.com/mySite123/indexdotcfm?x=a%2F

更新:

Top Level IIs:
Checked:  
  Allow unlisted file name extensions
  Allow unlisted verbs
  Allow high-bit characters
Unchecked:
  Allow double escaping

Request Limits:
Maximum allowed content length (Bytes):  30000000 Maximum URL length (Bytes):
4096 Maximum query string (Bytes):  2048

Sites
mySite123:
  Checked:  
    Allow unlisted verbs
    Allow high-bit characters
  Unchecked:
    Allow unlisted file name extensions
    Allow double escaping

  Request Limits:
    Maximum allowed content length (Bytes):  2147483647
    Maximum URL length (Bytes):  4096
    Maximum query string (Bytes):  2048

  Deny URL
    /CFIDE/Administrator
    /CFIDE/adminapi

更新:如果我更改了我正在点击的目录,我可以将403更改为404.示例:

这会按预期返回404:
http://www.example.com/anything.anything?anything=x%2Fanything

这返回403:
http://www.example.com/mySite123/anything.anything?anything=x%2Fanything

因此可以安全地假设403问题与“mySite123”虚拟目录设置有关吗?

解决方法

我很确定您将获得403 Forbidden响应作为IIS的安全功能.这是一种已知的攻击向量.字符序列/只是/(正斜杠)字符的URL编码表示.显然,这对浏览器和互联网具有特殊意义.它用于目录遍历.在URL中编码特殊字符是绕过一些基本安全措施的黑客技巧.见OWASP的 Path Traversal.从 Full text of “The Web Application Hacker Handbook”开始(大约在该页面的一半):

Chapter 10 Attacking Back-End Components 575

HACK STEPS

  1. Always try path traversal sequences using both forward slashes and back
    slashes. Many input filters check for only one of these,when the filesystem may support both.

  2. Try simple URL-encoded representations of traversal sequences using the
    following encodings.
    Be sure to encode every single slash and dot within
    your input:

    Dot — %2e
    Forward slash — %2f
    Backslash — %5c

  3. Try using 1 6-bit Unicode encoding:

    Dot — %u002e
    Forward slash — %u22l5
    Backslash — %u22l6

  4. Try double URL encoding:

    Dot-%252e
    Forward slash — %252f
    Backslash — %255c

  5. Try overlong UTF-8 Unicode encoding:

    Dot — %c0%2e,%e0%40%ae,%c0ae,and so on
    Forward slash — %cO%af,%e0%80%af,%c0%2f,and so on
    Backslash — %c0%5c,%c0%80%5c,and so on

(大胆是我的重点)

你可能想出一个方法来允许这个,但你为什么要这样做?我不推荐它.您想打开服务器以进行潜在的攻击吗?我认为最好一起避免这个URL序列. URL查询字符串中是否真的需要正斜杠字符?也许您可以使用不那么危险并且不会暴露您的服务器的不同方法,而不是在查询字符串中找到允许此字符的方法.对于该特定URL变量,您可以查找此不同的字符,并将其替换为服务器端所需的字符.就像是:

代替

http://example.com/index.cfm?x=a%2Fblah

使用

http://example.com/index.cfm?x=a-blah

然后在服务器上,你知道期望x变量中的 – (破折号)字符,所以你用服务器上的/(正斜杠)字符替换它.或者需要什么角色.

在ColdFusion中

<cfset x = Replace(URL.x,"-","/","ALL") />

请务必使用该字符串中不存在的某些唯一字符.始终记得清理服务器上所有用户提供的输入.

以下是我发现的一些关于URL中易受攻击的/字符序列的引用:

Component titles containing ‘/’ (forward slash) characters

IIS URL Decoding Vulnerability

Receive an HTTP 400 error if %2F is part of the GET URL in JBOSS

URL-encoded slash in URL

Generic Google search about the topic

请注意,上述某些引用与IIS以外的Web服务器有关,但它们表明存在漏洞.

你可能尝试的其他东西是双重逃避序列.所以代替/你有%2F(%是百分号).但是您需要在IIS中进行更改以支持此功能.参考 – if I name an image with a %2F,I cannot access it and when navigating to it,I get a 404.我认为这将是最后的手段. Double Encoding

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读