From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Roland Besserer Newsgroups: gmane.lisp.guile.user Subject: Re: Guile scripts and setuid bit -> trouble Date: 10 Jan 2005 16:03:48 -0800 Message-ID: References: <20050110081618.GA15094@www> Reply-To: roland@motorola.com NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1105402295 27409 80.91.229.6 (11 Jan 2005 00:11:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 11 Jan 2005 00:11:35 +0000 (UTC) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Jan 11 01:11:27 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Co9d8-0003K0-00 for ; Tue, 11 Jan 2005 01:11:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Co9lQ-0003Tm-Rl for guile-user@m.gmane.org; Mon, 10 Jan 2005 19:20:01 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Co9ki-0003FN-JW for guile-user@gnu.org; Mon, 10 Jan 2005 19:19:17 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Co9ke-0003C8-43 for guile-user@gnu.org; Mon, 10 Jan 2005 19:19:12 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Co9kd-0003BF-5r for guile-user@gnu.org; Mon, 10 Jan 2005 19:19:11 -0500 Original-Received: from [129.188.136.8] (helo=motgate8.mot.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Co9Vx-0001MI-Ml for guile-user@gnu.org; Mon, 10 Jan 2005 19:04:01 -0500 Original-Received: from il06exr06.mot.com (il06exr06.mot.com [129.188.137.136]) by motgate8.mot.com (Motorola/Motgate8) with ESMTP id j0B05kJD018697 for ; Mon, 10 Jan 2005 17:05:46 -0700 (MST) Original-Received: from pa06exr01.gic.gi.com (pa06exr01.gic.gi.com [168.84.176.73]) by il06exr06.mot.com (Motorola/il06exr06) with ESMTP id j0B03r61007572 for ; Mon, 10 Jan 2005 18:03:53 -0600 Original-Received: from kanaha.am.mot.com (kanaha.am.mot.com [10.72.33.151]) by pa06exr01.gic.gi.com (Motorola/8.11.6) with ESMTP id j0B0b7607358 for ; Mon, 10 Jan 2005 18:37:07 -0600 Original-Received: from motorola.com (localhost [127.0.0.1]) by kanaha.am.mot.com (8.12.5+Sun/8.12.5) with ESMTP id j0B03o59002642 for ; Mon, 10 Jan 2005 16:03:51 -0800 (PST) Original-Received: (from roland@localhost) by motorola.com (8.12.5+Sun/8.12.5/Submit) id j0B03npg002639; Mon, 10 Jan 2005 16:03:49 -0800 (PST) Original-To: In-Reply-To: <20050110081618.GA15094@www> Original-Lines: 58 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:4042 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:4042 Naturally, I'm aware of the inherent security issues but they are not a concern in this case (isolated machine, etc.).=20 The script is used to modify a simple text file which has -rw------- permissions and is owned by a separate user and group and the script is uid root. With the script perms -rwxr-xr-x and the test file set to -rw-rw-rw- everything works fine. If I limit the permissions on the text file and setuid the script (-rwsr-xr-x) I get the error. It does work as expected on OSX (guile 1.6.4), so this appears to be=20 Solaris specific. This is Solaris 8/9 by the way. Turns out that sh scripts also fail to run as setuid, but they don't give any parse errors, they just run with the real uid. I know there is a file system option (nosuid) but all my file system are mounted with the enable option (uid). roland p.s. By the way, I found that the guile-1.6.4 build on OSX does not support the Posix user information calls like (cuserid). writes: > On Thu, Jan 06, 2005 at 04:26:25PM -0800, Roland Besserer wrote: > >=20 > > Hi, > >=20 > > I am having an issue running guile scripts on a Solaris 9 machine. > > The script starts with the usual: > >=20 > > #!/usr/local/bin/guile \ > > -e main -s > > !# > [...] > > ERROR: Unbound variable: !# >=20 > hi, >=20 > don't know about Solaris -- but note that setuid *scripts* are > special. Done naively they are inherently insecure. Different > systems have different approaches to cope with that. Linux, for > example, just ignores the setuid bit on scripts (you can do > setuid Perl scripts, but that involves some suidperl black magic, > having a setuid Perl interpreter as one of its tasty ingredients, > yummm...). Maybe Solaris is passing an already-open file descriptor > to the shell (i.e. guile), on which the first line is ``read-off'', > so poor guile doesn't get the hash-bang at the beginning? >=20 > What happens if you append a backslash to the second line? What if > you change the last one to ``#! !#'' (looks funny, right ;-) >=20 > Regards > -- tom=E1s _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user