From: Oleg Verych <olecom@flower.upol.cz>
To: "H. Peter Anvin (dash list)" <dash@vger.kernel.org>
Subject: Re: euidaccess() vs non suid /bin/sh (Re: dash test -w oddities)
Date: Thu, 1 May 2008 02:19:23 +0200 [thread overview]
Message-ID: <20080501001923.GS24008@flower.upol.cz> (raw)
In-Reply-To: <4818F829.60601@zytor.com>
> >I wonder even more why access() syscall isn't a solution, because
> >/bin/sh isn't set-uid by definition.
> >
> >#/bin/cc glibc/sysdeps/posix/euidaccess.c
> >[...]
> > /* If we are not set-uid or set-gid, access does the same. */
> > return access (path, mode);
> >[...]
> >#end_cc
>
> It might be run from a setuid program.
Scripts with '#!/bin/sh' cannot be set-uid,
#man system (debian):
Do not use system() from a program with set-user-ID or set-group-ID
privileges, because strange values for some environment variables might
be used to subvert system integrity. Use the exec(3) family of func-
tions instead, but not execlp(3) or execvp(3). system() will not, in
fact, work properly from programs with set-user-ID or set-group-ID
privileges on systems on which /bin/sh is bash version 2, since bash 2
drops privileges on startup. (Debian uses a modified bash which does
not do this when invoked as sh.)
#end
Programs being designed to be set-uid should have proper setup for
proper running any external command. No?
The call euidaccess() makes sense now, just asking to make clear this
mess a bit.
____
next prev parent reply other threads:[~2008-04-30 23:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-30 21:05 dash test -w oddities Remi Broemeling
2008-04-30 22:38 ` Oleg Verych
2008-04-30 23:01 ` euidaccess() vs non suid /bin/sh (Re: dash test -w oddities) Oleg Verych
2008-04-30 22:52 ` H. Peter Anvin
2008-05-01 0:19 ` Oleg Verych [this message]
2008-05-01 6:03 ` H. Peter Anvin
2008-05-02 16:48 ` Oleg Verych
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080501001923.GS24008@flower.upol.cz \
--to=olecom@flower.upol.cz \
--cc=dash@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox