Lucene search

K
seebugRootSSV:3475
HistoryJun 25, 2008 - 12:00 a.m.

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

2008-06-2500:00:00
Root
www.seebug.org
10

0.0004 Low

EPSS

Percentile

8.0%

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

Larry Wall Perl 5.10
Larry Wall

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

<a href=“http://www.perl.org/” target=“_blank”>http://www.perl.org/</a>

0.0004 Low

EPSS

Percentile

8.0%