On May 21, Laurent Marzullo said:

>Insecure dependency in mkdir while running setuid at ....
>.../File/Path.pm line 137

>sub create_rcsdir
>{
>       local( $cctrl , $group ) = @_;
>       local( $rcsdir ) = $ENV{ RCSDIR };
>
>       mkpath( $rcsdir , 1 , 0750 );
>}

I bet the problem is due to $ENV{RCSDIR}.  You need to make sure you can
trust it.  To do so, you might want to do something like:

  if ($ENV{RCSDIR} =~ m!^(/opt/rcs/(?:\w+/)*\w+)$!) {
    $rcsdir = $1;
  }
  else {
    die "invalid RCSDIR path ($ENV{RCSDIR})";
  }

The cause is that your environment becomes tainted and insecure when
running under setuid (or perl -T).  So you need to apply a regex to the
string, and extract the safe content that way.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
** I need a publisher for my book "Learning Perl's Regular Expressions" **

Reply via email to