suid not working as I'd hope???

David Collier from_busybox_maillist at dexdyne.com
Tue Jan 18 12:15:00 UTC 2011


Denys,

If I want to reproduce the effect whereby setting the s bit on the
busybox exe allows all applets to run as root....

is the best patch to simply comment out those 2 lines you pointed to?

TVM

David








In article <AANLkTik8RiRi_TPuSc-S8=_BjPB9jiLKnS9k=frHxEiA at mail.gmail.com>,
vda.linux at googlemail.com (Denys Vlasenko) wrote:

> *From:* Denys Vlasenko <vda.linux at googlemail.com>
> *To:* from_busybox_maillist at dexdyne.com
> *CC:* busybox at busybox.net
> *Date:* Mon, 17 Jan 2011 19:57:11 +0100
> 
> On Mon, Jan 17, 2011 at 6:38 PM, David Collier
> <from_busybox_maillist at dexdyne.com> wrote:
> > I have the following set-up
> >
> > $ ls -l /bin/busybox
> > -rwsr-xr-x 1 root root 376108 2008-09-07 23:29 /bin/busybox
> >
> > $ ls -l /bin/date
> > -rwsr-xr-x 1 root root 55052 2008-04-04 14:22 /bin/date
> >
> > if I login as web, I can change the date with "date", but if I do
> > "busybox date" it comes back with
> >
> >    date: cannot set date: Operation not permitted
> 
> Which is good.
> Otherwise, busybox cp /my/file /etc/passwd would work too.
> 
> > Can anyone suggest why I've failed to get busybox to adopt root 
> > user and
> > do the job?
> 
> Because of this in libbb/appletlib.c:
> 
> static void check_suid(int applet_no)
> {
> ...
>         if (APPLET_SUID(applet_no) == _BB_SUID_REQUIRE) {
>                 /* Real uid is not 0. If euid isn't 0 too, suid bit
>                  * is most probably not set on our executable */
>                 if (geteuid())
>                         bb_error_msg_and_die("must be suid to work 
> properly");
>         } else if (APPLET_SUID(applet_no) == _BB_SUID_DROP) {
> HERE =>         xsetgid(rgid);  /* drop all privileges */
> HERE =>         xsetuid(ruid);
>         }
> }
> 
> date is _BB_SUID_DROP applet.
> 
> -- 
> vda
> 


More information about the busybox mailing list