Avenger's News 存在目录遍历漏洞发布时间:2002-02-26 更新时间:2002-02-26 严重程度:中 威胁程度:远程非授权文件存取 错误类型:输入验证错误 利用方式:服务器模式 BUGTRAQ ID:4147 受影响系统 Avenger's News System Avenger's News System 2.01详细描述 Avenger's News System (ANS) 是一款基于WEB的新闻管理系统。 其中ANS没有过滤从WEB请求的(../)字符,可导致目录遍历,攻击者可以读取任意 可读文件。 测试代码 ans.pl?p=../../../../etc/passwd 解决方案 采用如下补丁代码: if (substr($QUERY, 0, 2) eq "p="){ $QUERY =~ s/([\&;\`'\\\|"*?~<>^\(\)\[\]\{\}\$\n\r])/\\$1/g; #filter meta characters $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; } 相关信息 "b0iler _" <b0iler@hotmail.com>. 参考:http://online.securityfocus.com/archive/1/257367 相关主页:http://ans.gq.nu/ |