服务器 | 设计圈 |


777yjt 的BLOG 
留言  收藏

2008 11.18 Tue
      1
2345678
9101112131415
16171819202122
23242526272829
30      
«» 2008 - 11 «»

搜索BLOG文章

 

博客基本信息
用户名: 777yjt
等级: 四星会员
威望: 4360
金钱: 10875
在线时间: 2786 分钟
日志总数: 2175
评论数量: 24
访问次数: 92188
建立时间: 2006-10-07




XML RSS 2.0 WAP

作者: 777yjt   发表日期: 2006-12-01
复制 TAG: 收藏

提起微软公司IIS web服务器的安全问题,很多人立刻就会联想到那些为人们所称颂的致命

漏洞: UNICODE , CGI 解析, .ida,idq, .Printer远程溢出等. 这些伟大的漏洞恐怕是我等scripts

kidding的最爱了,利用他们可以很轻松的拿到较高的系统权限。但是这篇文章并非是讨论这些致命的漏洞的,只是比较详细的介绍了如何远程判断IIS 服务器的各种设置,如目录权限,认证方法等等,文中有些东西已经很老了,但是新的东西还是值得一看的。 希望本文能够起到一个抛砖引玉的作用。好了,废话少说,Go~!

远程确定目录权限

让我们打开一个IIS服务器来看看。在IIS 服务管理器中,选择一个目录,看他的属性

在目录属性项有有这么一些选项(日志访问和索引此资源不计):

脚本资源访问:对网站的脚本可以读取原文件。

读取 读取目录里面的静态资源。

写入 用户可以建立以及删除资源

目录浏览 用户可以浏览目录内容。

应用程序设置的执行许可中有三个选项:

无 只能访问静态页面

纯脚本 只允许允许脚本如ASP脚本

脚本和可执行程序 可以访问和执行各种文件类型

那么,如何确定服务器上面的这些开关设置呢? 别着急,一个一个来。

执行权限

如何确定某个目录是否开了执行权限呢?很简单,向服务器发送一个下面得请求:

http://iis-server/dir/no-such-file.dll

/dir/为要判断得目录,no-such-file.dll是随便取得一个名字,服务器上面没有这个文件。

服务器对我们得请求会返回一个信息。如果返回的是一个500错误:

HTTP 500 - 内部服务器错误 (Internal Server error)

那么就说明这个目录的执行权限是开着的。 对于服务器,能不开执行权限的就不要开。特别是虚拟目录的执行权限,大家想一想UNICODE和二次解码漏洞的利用过程就明白了。

如果服务器返回的是一个 404 错误:

HTTP 404 - 未找到文件

那么就说明这个目录的执行权限没有开。

写权限

测试一个目录对于web用户是否具有写权限,采用如下方法:

telnet 到服务器的web端口(80)并发送一个如下请求:

PUT /dir/my_file.txt HTTP/1.1

Host: iis-server

Content-Length: 10 <enter><enter>

这时服务器会返回一个100( 继续)的信息:

HTTP/1.1 100 Continue

Server: Microsoft-IIS/5.0

Date: Thu, 28 Feb 2002 15:56:00 GMT

接着,我们输入10个字母:

AAAAAAAAAA

送出这个请求后,看服务器的返回信息,如果是一个 201 Created响应:

HTTP/1.1 201 Created

Server: Microsoft-IIS/5.0

Date: Thu, 28 Feb 2002 15:56:08 GMT

Location: http://iis-server/dir/my_file.txt

Content-Length: 0

Allow: OPTIONS, TRACE, GET, HEAD, DELETE, PUT, COPY, MOVE, PROPFIND,

PROPPATCH, SEARCH, LOCK, UNLOCK

那么就说明这个目录的写权限是开着的,反之,如果返回的是一个 403 错误,那么写权限就是

没有开起来,如果需要你认证,并且返回一个 401(权限禁止) 的响应的话,说明是开了写权限,但是匿名用户不允许。 如果一个目录同时开了”写”和“脚本和可执行程序”的话,那么web用户就可以上传一个程序并且执行它,恐怖哦%^#$!~

纯脚本执行权限

这样的目录就太多了。很多不需要给执行权限的目录也被管理员给了脚本执行权限,我记得在

shotgun的一篇文章里面他说过:最小的权限+最少的服务= 最大的安全 ; 一点也没有错。给目录任何多余的权限都是没有必要的。判断一个目录是否可以执行纯脚本文件也很简单,发送一个如下一个请求:

http://iis-server/dir/no-such-file.asp

返回404文件不存在说明有执行权限,返回403则是没有开。

浏览目录权限

判断一个目录是否允许浏览可能需要一点点小技巧,但是,在网站的默认首页(如:default.asp)不存在的话,那么就再简单不过了。 在浏览器里面输入:

http://iis-server/dir/

如果权限开着的,那么会返回200响应,并且列出当前目录里面的内容,反之,没有列出目录的话就是关了。 但是,如果默认页面default.asp存在呢?敲入上面的地址就直接打开这个页面了。别急,

WebDAV 里面有一个请求方法叫:PROFIND。这个方法使得我们可以从服务器资源里面得到一些如文件名,创建时间,最后修改时间等等的信息。利用它我们也可以绕过 default.asp 来判断目录浏览权限的情况, telnet到IIS-server的web端口,发送如下请求:

PROPFIND /dir/ HTTP/1.1

Host: iis-server

Content-Length: 0

这时,服务器会送回一个207 Multi Status的响应,如果目录是允许浏览的,那么同时会列出目录里面的资源以及他们的属性。如果目录浏览不允许,返回的信息就会少的多。目录浏览一般来说只能算是一个低危险等级的漏洞,比如一个images目录,里面除了图片没有别的东西了,那对于服务器的安全就没有什么危害,但是,如果目录里面放了一个管理页面adminpage.asp或者一些数据库连接信息文件,可能会导致你的服务器拱手相让给入侵者。

读权限

判断这点很容易,发一个带 txt文件的请求就可以:

http://iis-server/dir/no-such-file.txt

如果返回一个 404 文件不存在的响应,就说明读权限是开着的,反正,返回403错误则说明都权限没有开。早几年接触安全的人一定知道 ::$DATA泄露ASP源代码的漏洞,其实如果一个目录里面权势asp脚本的话,那么读权限也可以不用开的,ASP只需要脚本执行权限就可以了。

IIS 认证方法的判断

这个漏洞是最近才公布出来的,IIS服务器支持匿名访问,基本认证和使用NTLM方式的windows集成认证,如果客户端发送一个包含认证信息的请求,IIS就会强行的尝试用这些认证信息取认证,并且放回不会的响应。这样我们就能够确定IIS的认证的配置。

要确定IIS是否支持基本认证,可以telnet到服务器的80端口,发送如下请求:

GET / HTTP/1.1

Host: iis-server

Authorization: Basic c3lzdGVtOm1hbmFnZXIA

这是一个基本认证的请求,里面包含了一个base 64编码的用户ID和PASS,Basic后面那串字符经过base 64解码以后就是 system:manager 。如果服务器返回一个401信息,则说明基本认证选项是开着的。如果返回200信息,则有2种可能,基本认证选项没有开或者是服务器存在一个用户名是

system的用户名,并且密码是manager (猜中的话,行大运啦)。

要确定NTLM选项是否开启则可以向IIS发送如下请求

GET / HTTP/1.1

Host: iis-server

Authorization: NegotiateTlRMTVNTUAABAAAAB4IAoAAAAAAAAAAAAAAAAAAAAAA=

同样,如果返回401消息,则说明支持NTLM,返回200说明不NTLM认证选项没有开启。

对于大多数网站来说,这两种认证方式都是不需要开起的来,他们有可能泄露一些服务器的重要信息。

泄露内部IP地址信息

如果IIS服务器在一个使用NAT的防火墙里面的话,通常都有个内部地址如10.x.x.x。

如果IIS开启了基本认证选项,那么发送如下一个简单的请求就可以得到服务器的内部IP:

GET / HTTP/1.1

Host:

Authorization: Basic c3lzdGVtOm1hbmFnZXIA

服务器将返回一个如下响应:

HTTP/1.1 401 Access Denied

Server: Microsoft-IIS/5.0

Date: Fri, 01 Mar 2002 15:45:32 GMT

WWW-Authenticate: Basic realm="10.1.1.2"

Connection: close

Content-Length: 3245

Content-Type: text/html

那个10.1.1.2就是机器的内部ip地址,本来realm的值是客户端提供给的一个主机头,但这里它是空的,所以IIS就选择了本机的IP地址来代替。同样的,利用PROPFIND,WRITE,MKCOL等请求的返回信息,也能泄露主机的一些信息,如我们向服务器提请下面这样一个请求:

PROPFIND / HTTP/1.1

Host:

Content-Length: 0





在IIS配置成使用主机名(见后)的情况下,则不会暴露主机的IP地址,但是会暴露NetBIOS名。事实上我们可以利用IIS的认证获得更多的信息,如所在域的名字,方法是向服务器发送如下带NTLM认证的请求:





GET / HTTP/1.1


Host: iis-server


Authorization: NegotiateTlRMTVNTUAABAAAAB4IAoAAAAAAAAAAAAAAAAAAAAAA





服务器会返回一个信息:





HTTP/1.1 401 Access Denied


Server: Microsoft-IIS/5.0


Date: Fri, 01 Mar 2002 16:24:58 GMT

WWW-Authenticate: Negotiate TlRMTVNTUAACAAAADAAMADAAAAAFgoKgeGvyVuvy67U

AAAAAAAAAAEQARAA8AAAAUwBDAFkATABMAEEAAgAMAFMAQwBZAEwATABBAAEA


DABTAEMAWQBMAEwAQQAEAAwAUwBDAFkATABMAEEAAwAMAFMAQwBZAEwATABB


AAAAAAA=


Content-Length: 3245


Content-Type: text/html





那一长串字符就包含了主机名和NT所在域的名字的base 64 编码。





临时解决方法:在cmd下进入c:\inetpub\adminscripts或者是adminiscript所在目录执行一下命令




adsutil set w3svc/UseHostName True

net stop iisadmin /y

net start w3svc




默认应用程序映射判断


判断默认映射是否存在比较简单,这里只简单的给出了在映射存在的情况下对于相应请求的响应:





扩展名: .printer


请求: http://iis-server/foo.printer


响应: HTTP 500 - 内部服务器错误





扩展名:.idc


请求:http://iis-server/foo.idc


响应: code 500 Internal Server Error











扩展名:.idq


请求:http://iis-server/foo.idq


响应码:200 OK


响应:找不到 IDQ 文件 D:\dir\\foo.idq








扩展名:.ida


请求: http://iis-server/foo.ida


响应码:200 OK


响应: 找不到 IDQ 文件 D:\dir\foo.ida








扩展名:.htr


请求: http://iis-server/foo.htr


响应: HTTP 404 - 未找到文件





扩展名:.htw


请求: http://iis-server/foo.htw


响应码: 200 OK


响应: QUERY_STRING 的格式无效





扩展名:.stm


请求: http://iis-server/foo.stm


响应: HTTP 404 - 未找到文件





扩展名:.shtm


请求: http://iis-server/foo.shtm


响应: HTTP 404 - 未找到文件





扩展名:.shtml


请求: http://iis-server/foo.ida


响应:HTTP 404 - 未找到文件








判断操作系统是否为个人版本(Professional/Workstation )


IIS安装在windows2000专业版和NT workstation上面时候,同时进行的连接数最大为10个,利用这一点我们可以简单判断操作系统版本:创建10个 HTTP 1.1的持续连接,第11个连接请求将放回403错误信息。





后话:由于各种原因,我所在的公司关门大吉了,没有工作,心就乱糟糟的,所以翻译的时候也是砍头去尾的,大家不要骂我,我拿去黑客防线骗稿费的啦。如果有不明白的地方可以参考以下几篇:


http://www.nextgenss.com/papers/iisrconfig.pdf 英文原文


http://www.nextgenss.com/advisories/iisauth.txt


http://www.nextgenss.com/advisories/iisip.txt

相关链接:
apache五合一程序建立PHP+CGI运行环境 http://club.sob8.com/read-htm-tid-40192.html


本文地址http://777yjt.sob8.com/blog-htm-do-showone-itemid-5341.html



文章评论1829条回复
  guest
2008-10-21


For ten thousand years. apple ipod   the immortal night elves. cell phones cultivated a druidic society . cheap cell phones within the shadowed recesses of Ashenvale Forest. cheap wow gold Then the catastrophic. cheapest wow gold invasion of the Burning Legion. digital camera shattered the tranquility of. digital cameras   their ancient civilization. free online war games Led by the Arch-Druid Malfurion. ipod   Stormrage and the Priestess. ipod nano   Tyrande Whisperwind. ipod shuffle the mighty night elves rose. ipod touch to challenge the demonic onslaught. ipods Aided by the newly. lotro gold arrived orcs and humans. online games the night elves succeeded. phones cell   in halting the Legion's. play war games advance and defeating its master. power level the demonlord Archimonde. power leveling Though victorious. warhero on line the night elves were forced. world of warcraft gold to sacrifice their. wow gold cherished immortality. wow level and watch their beloved forests burn. wow powerlevel

  guest
2008-10-29


<a href="http://www.mp3playerbuying.com/Shops/2GB-MP3-Player.aspx">2GB MP3 PLAYER</a> There are a few world of Warcraft alliance. <a href="http://www.mp3playerbuying.com/Shops/4GB-MP3-Player.aspx">4GB MP3 PLAYER</a> leveling guides on the internet these days. <a href="http://www.gamesavor.com">buy wow gold</a> One of the most popular guides is Brian. <a href="http://www.gamesavor.com">buying gold world of warcraft</a> Kopp's World of Warcraft Alliance Leveling. <a href="http://www.mp3playerbuying.com/Shops/Cell-Phones.aspx">cell phones</a> Guide This guide was the first WoW alliance. <a href="http://www.mp3playerbuying.com/Shops/Cell-Phones.aspx">cheap cell phones</a> leveling guide to provide step-by-step. <a href="http://www.cheapwowgold4u.com">cheap wow gold</a> instructions on how to quickly level any. <a href="http://www.gamesavor.com">cheap wow gold</a> Alliance Character in World of Warcraft The. <a href="http://www.buycheapwowgold.co.uk">cheap wow gold</a> starting points for each of the Alliance. <a href="http://www.gamesavor.com">cheapest wow gold</a> races is plotted out individually This is. <a href="http://www.eveonline4isk.com">eve isk</a> different from other guides like James. <a href="http://www.mp3playerbuying.com">mp3 players</a> Alliance Leveling Guide James Alliance. <a href="http://www.mp3playerbuying.com/Shops/Cell-Phones.aspx">phones cell</a> Leveling Guide focuses mainly on leveling a. <a href="http://www.mp3playerbuying.com/Shops/Portable-MP3-Players.aspx">portable mp3 player</a> human character in World of Warcraft James. <a href="http://www.mp3playerbuying.com/Shops/Portable-MP3-Players.aspx">portable mp3 players</a> guide does not go into specifics about the. <a href="http://www.gamesavor.com">sell wow gold</a> other Alliance races like the Gnomes or. <a href="http://www.gamesavor.com">world of warcraft gold</a> Dwarves or Night Elves Another aspect that. <a href="http://www.wowgold4europe.fr">wow</a> sets Brian Kopp's World of Warcraft Alliance. <a href="http://www.gamesavor.com">wow gold</a> Leveling Guide apart is the amount of detail. <a href="http://www.wowgold4europe.de">wow gold</a> included with the quests Each quest is linked. <a href="http://www.wowgold4europe.fr">wow gold</a> to one of the leading World of Warcraft. <a href="http://www.cheapwowgold4u.com">wow gold</a> resources on the internet thottbot com This. <a href="http://www.buycheapwowgold.co.uk">wow gold</a> means that anytime a player has a question. <a href="http://www.gamesavor.com/WOW/WorldOfWarcraft-DE.aspx">wow gold</a> about a quest they can click on the link to get. <a href="http://www.gamesavor.com/WOW/WorldOfWarcraft-DE.aspx">wow gold kaufen</a> additional information. <a href="http://www.wowgold4europe.de">wow gold kaufen</a>

  guest
2008-10-29


2GB MP3 PLAYER Brian Kopp's World of Warcraft Alliance. 4GB MP3 PLAYER Leveling Guide also includes numerous. buy wow gold tips for improving leveling speed I found. buying gold world of warcraft this tips alone to be very helpful They. cell phones improved my Alliance leveling speed. cheap cell phones tremendously Brian Kopp was also a beta. cheap wow gold tester for the Burning Crusade expansion. cheap wow gold and released the update 60-70 portion of. cheap wow gold his guide within a week of when Burning. cheapest wow gold Crusade became available Brian Kopp's WoW. eve isk Alliance Leveling Guide is easily the best. mp3 players resource available for any Alliance player. phones cell looking to improve their leveling in World. portable mp3 player of Warcraft All of the quest information. portable mp3 players for each Alliance race in condensed into. sell wow gold an easy to follow step-by-step guide I. world of warcraft gold found it a struggle sometimes to keep track. wow of where I should go next with James WoW Alliance. wow gold Leveling Guide That wasn't the case with. wow gold Brian Kopp's guide His guide has helped. wow gold my new Night Elf Hunter get to level. wow gold 20 in record time I'm leveling faster than. wow gold ever now I wish I had picked up Brian. wow gold Kopp's World of Warcraft Alliance Leveling. wow gold kaufen Guide sooner. wow gold kaufen

<<   1   2   3   4   5  >>  Pages: ( 1/92 total )