[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: discarding root privileges in suid perl



>>>>> "Miquel" == Miquel van Smoorenburg <miquels@cistron.nl> writes:

    Miquel> In article <84lmvpg3bz.fsf@snoopy.apana.org.au>, Brian May
    Miquel> <bam@debian.org> wrote:
    >> According to "man perlsec", line 300+, the following code
    >> should destroy extra privileges in a suid root perl script:
    >> 
    >> $EUID = $UID; $EGID = $GID; # initgroups() also called!

    Miquel> You need to 'use English' for the $EUID etc variables to
    Miquel> work.  Otherwise use $>, $<, etc. See 'man perlvar'

Already done. I also use strict, to ensure mistakes like this cannot
happen.

As for this problem, I suspect perl or libc6 might be caching the old
permissions somewhere, but I don't understand how or why.

Otherwise, it should normally be impossible for a non-root program (ie
UID!=root and EUID!=root) to suddenly obtain root privileges.
-- 
Brian May <bam@debian.org>



Reply to: