/etc/busybox.conf confusion [secutiry?]

Denis Vlasenko vda.linux at googlemail.com
Wed May 2 22:39:07 UTC 2007


On Tuesday 01 May 2007 23:25, Tito wrote:
> Just for the fun while studying how check_suid() works i've rewritten it....
> Can you test if this fixes your problem?
> 
> Ciao,
> Tito

I like it. I really do. But:

        /* if we are root this is skipped as suid_cfg_readable is 0 */
        if (suid_cfg_readable) {
...
        } else {
                if (!ENABLE_FEATURE_SUID_CONFIG_QUIET) {
                        static bool onetime = 0;

                        if (ruid && !onetime) {
                                onetime = 1;
                                fprintf(stderr, "Using fallback suid method\n");
                        }
                }
        }


if ENABLE_FEATURE_SUID_CONFIG_QUIET=n, root will always see bogus complaint.

        xsetuid(ruid);
        xsetgid(rgid);

You have to set effective and saved ids, without touching real ids.
This is needed by su etc to find whether they were called by non-root
(they use getuid() for that).

Or do this: (a) do not clobber static uid_t ruid, (b) make it visible
in all applets [make it global, not static], (c) chase getuid() calls
in all applets and replace them with testing global ruid.

This can squize some tens of bytes and save few getuid() calls, but
it's sorta complicated, especially that ruid variable currently exists only
if FEATURE_SUID=y... probably this is needed:

/* libbb.h */
#if ENABLE_FEATURE_SUID
extern uid_t bb_ruid;
#define BB_RUID() bb_ruid
#else
#define BB_RUID() getuid()
#endif

Oh...
--
vda



More information about the busybox mailing list