安全研究

安全漏洞
Perl rmtree()函数本地不安全权限漏洞

发布日期:2008-06-23
更新日期:2008-06-24

受影响系统:
Larry Wall Perl 5.10
描述:
BUGTRAQ  ID: 29902
CVE(CAN) ID: CVE-2008-2827

Perl是一种免费且功能强大的编程语言。

Perl的lib/File/Path.pm文件中的rmtree函数在执行chmod时没有正确地检查权限:

            my $nperm = $perm & 07777 | 0600;
            if ($nperm != $perm and not chmod $nperm, $root) {
                if ($Force_Writeable) {
                    _error($arg, "cannot make file writeable", $canon);
                }
            }

上述代码仅在尝试chmod后才测试$Force_Writeable变量,该变量用于定义在删除文件时操作系统是否需要写权限。当rmtree()遇到符号链接时,就会将链接目标的权限更改为链接的权限,通常为0777。

% touch foo
% ln -s foo bar
% ls -l foo bar
lrwxrwxrwx 1 niko niko 3 2008-06-21 09:06 bar -> foo
-rw-r--r-- 1 niko niko 0 2008-06-21 09:06 foo
% perl -e 'use File::Path rmtree; rmtree bar'
% ls -l foo bar
ls: cannot access bar: No such file or directory
-rwxrwxrwx 1 niko niko 0 2008-06-21 09:06 foo

<*来源:Ben Hutchings (ben@decadent.org.uk
  
  链接:http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487319
        http://rt.cpan.org/Public/Bug/Display.html?id=36982
*>

建议:
厂商补丁:

Larry Wall
----------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:

http://www.perl.org/

浏览次数:2592
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障