Re: Bug: mount doing bad security check: only root can use -types, (effective EUID is 5013)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 06, 2017 at 07:15:01AM -0700, L A Walsh wrote:
> Karel Zak wrote:
> > ruid = getuid();
> >     euid = geteuid();
> > 
> >     cxt->restricted = (uid_t) 0 == ruid && ruid == euid ? 0 : 1;
> > 
> > in your case geteuid() returns 5013.
> ----
>    But my EUID isn't 5013 ("LOGINUID" is). That's the complaint/bug. 

The code it pretty simple, it just get euid from kernel and print
it. The error message is independent on another code and libmount.
I don't see any room for bug there. Your euid is 5013. 

You can also try "strace -o log mount --types xxx /dev/foo /mnt/bar" 
and see the "log" file where will be geteuid()...

This code is without relevant changes since 2011-01-10.

    Karel

static void __attribute__((__noreturn__)) exit_non_root(const char *option)
{
	const uid_t ruid = getuid();
	const uid_t euid = geteuid();

	if (ruid == 0 && euid != 0) {
		/* user is root, but setuid to non-root */
		if (option)
			errx(MNT_EX_USAGE, _("only root can use \"--%s\" option "
					 "(effective UID is %u)"),
					option, euid);
		errx(MNT_EX_USAGE, _("only root can do that "
				 "(effective UID is %u)"), euid);
	}
	if (option)
		errx(MNT_EX_USAGE, _("only root can use \"--%s\" option"), option);
	errx(MNT_EX_USAGE, _("only root can do that"));
}


-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux