home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!think.com!yale.edu!ira.uka.de!chx400!bernina!karrer
- From: karrer@bernina.ethz.ch (Andreas Karrer)
- Subject: Perl4.035 on a Convex
- Message-ID: <1992Nov12.180859.5956@bernina.ethz.ch>
- Keywords: suidperl mechanism, perl4.035, Convex
- Organization: Swiss Federal Institute of Technology (ETH), Zurich, CH
- Date: Thu, 12 Nov 1992 18:08:59 GMT
- Lines: 72
-
-
- First a little history:
-
- - Up to ConvexOS 9.0, Convexen were vulnerable to the #!-setuid-script bug.
- - With 9.0, the kernel simply refused to execute scripts with the
- set[u|g]id bit set -- making suidperl unusable. I filed a problem
- report, and, lo and behold:
- - 10.0 made the kernel's behaviour upon encountering setuid script a
- boot-time parameter:
- 0) 9.0 style (for the paranoid),
- 1) pre-9.0 style (for those who use their convex as a PC)
- 2) kernel passes the script to the interpreter, but ignores the
- setuid bit.
- 2) is what is needed for taintperl/suidperl to work.
-
- It was certainly reassuring to see my own words printed in the release notes,
- followed by a "Problem fixed". There _are_ vendors who react on user's
- complaints. Thanks Convex!
-
- However, when trying to run a setuid taintperl script with the perl4.010
- supplied with 10.1, i get:
-
- % ./setuid-script
- Can't reswap uid and euid
-
- Bummer. The message comes from perl.c when it tries to invoke setreuid().
-
- So i compiled 4.035 with:
-
- Any additional cc flags? [] -pcc
-
- Any additional libraries? [] -lnsl -ldbm -lm -lcrypt
- (Convex does not ship crypt.o in its libc.a anymore (intl.
- version) so i put mine into /usr/local/lib/libcrypt.a)
-
- In config.sh, i set:
- groupstype='gid_t' (was int)
- d_setregid='undef' (was define)
- d_setreuid='undef' (was define)
-
- The last two are neccessary for suidperl to work. Convex _has_
- setreuid(2)/setregid(2), but these work only for "POSIX mode processes".
- I assume the -pcc flag above makes this perl non-POSIX.
-
- After a surprisingly fast compilation (previous C optimizers spent ages on
- toke.c and eval.c) i got:
-
- % cat shscript
- #!/bin/sh
- whoami
- % cat perlscript
- #!/usr/bin/taintperl
- print scalar getpwuid($>) , "\n";
- % ls -l perlscript shscript
- -rwsr-xr-x 1 root 55 Nov 12 18:11 perlscript
- -rwsr-xr-x 1 root 17 Nov 12 18:12 shscript
- % ./shscript; ./perlscript
- karrer
- root
-
- Success!!!
-
- BTW it is unwise to put perl into /usr/local/bin or somesuch on a
- Convex. Most of Convex' installation script are now written in perl;
- they assume the partition perl lives on is mounted. Also, save a copy
- of the perl that comes with ConvexOS.
-
- - Andi
-
- +-----------
- Andi Karrer, Communication Systems, ETH Zuerich, Switzerland
- karrer@bernina.ethz.ch - Objects in mirror are closer than they appear
-