Avenger's News System目录遍历漏洞


添加时间:
2005-08-11

系统编号:
WAVDB-00130
BugCVE: CAN-2002-0307
BUGTRAQ: 4147

影响版本:
Avenger's News System 2.11-2.01

程序介绍:

Avenger's News System (ANS)是用Perl编写的基于表单的WEB更新、管理工具,可运行于绝大多数Unix/Linux系统上。

漏洞分析:

ANS没有过滤URL请求中的 ../ ,容易遭受目录遍历攻击,导致任意WEB Server进程有权读取的文件内容泄漏。

在ANS的配置文件中定义了$QUERY变量

<define QUERY> $ENV{'QUERY_STRING'} 

ANS实现中存在如下代码处理URL POST请求

  if (substr($QUERY, 0, 2) eq  p= )
  {
    $plugin = substr((split /&/, $QUERY)[0], 2);
    if (index( $QUERY ,  & ) < 0) { $QUERY =   ; }
                             else { $QUERY = substr($QUERY, index( $QUERY ,
 & )+1); }


    open (PLUGIN,  $FILE_LOCATION/$plugin );
    @plugin = <PLUGIN>;
    close (PLUGIN);


    eval( @plugin );
    exit;
  }



解决方案:
临时解决方法:
b0iler _ (b0iler@hotmail.com)建议您采取以下措施以降低威胁:
* 把程序中的以下代码:
if (substr($QUERY, 0, 2) eq p= )
{
$plugin = substr((split /&/, $QUERY)[0], 2);
if (index( $QUERY , & ) < 0) { $QUERY = ; }
else { $QUERY = substr($QUERY, index( $QUERY ,
& )+1); }
open (PLUGIN, $FILE_LOCATION/$plugin );
@plugin = <PLUGIN>;
close (PLUGIN);
eval( @plugin );
exit;
}
改为:
if (substr($QUERY, 0, 2) eq p= ){
$QUERY =~ s/([\&;\`'\\\| *?~<>^\(\)\[\]\{\}\$\n\r])/\\$1/g; # 过滤某些转义字符
$QUERY =~ s/\.\.//g; #filter double dot (..)
$plugin = substr((split /&/, $QUERY)[0], 2);
if (index( $QUERY , & ) < 0) { $QUERY = ; }
else { $QUERY = substr($QUERY, index( $QUERY , & )+1); }
open (PLUGIN, <$FILE_LOCATION/$plugin ); #added a < to the open() -
readonly
@plugin = <PLUGIN>;
close (PLUGIN);
eval( @plugin );
exit;
}

厂商补丁:
Avenger
-------
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:
http://ans.gq.nu/

信息来源:
<*来源: b0iler _ (b0iler@hotmail.com)
链接:http://archives.neohapsis.com/archives/bugtraq/2002-02/0229.html
*>