lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 07 Dec 2011 11:40:19 -0800
From:	Andy Lutomirski <luto@....EDU>
To:	Colin Walters <walters@...bum.org>
CC:	LKML <linux-kernel@...r.kernel.org>, morgan@...nel.org,
	serue@...ibm.com, dhowells@...hat.com, kzak@...hat.com
Subject: Re: chroot(2) and bind mounts as non-root

On 12/07/2011 09:54 AM, Colin Walters wrote:
> Hi,
> 
> (TL;DR version: Please audit the attached setuid program)
> 
> I've recently been doing some work in software compilation, and it'd be
> really handy if I could call chroot(2) as a non-root user.  The reason
> to chroot is to help avoid "host contamination" - I can set up a build
> root and then chroot in.  The reason to do it as non-root is, well,
> requiring root to build software sucks for multiple obvious reasons.
> 
> (Now you can do LD_PRELOAD hacks to talk to a daemon like
> https://github.com/wrpseudo/pseudo does, but really - too gross and too
> slow).
> 
> The historical reason one can't call chroot(2) as non-root is because of
> setuid binaries (hard link a setuid binary into chroot of your choice
> with trojaned libc.so).  But it turns out a while back this commit:
> 
> commit 3898b1b4ebff8dcfbcf1807e0661585e06c9a91c
> Author: Andrew G. Morgan <morgan@...nel.org>
> Date:   Mon Apr 28 02:13:40 2008 -0700
> 
>     capabilities: implement per-process securebits
> 
> Added *exactly* what we need.  We just call:
> 
> prctl (PR_SET_SECUREBITS, SECBIT_NOROOT | SECBIT_NOROOT_LOCKED);
> 
> A setuid program to call both this and chroot(2) is *almost* good enough
> for my use case - but it's a little hard to run most build software
> without say /dev/null, /dev/urandom and /proc.
> 
> The other key thing Linux recently gained is CLONE_NEWNS - with this
> (and also SECBIT_NOROOT), we can allow users to make bind mounts to
> their heart's content, which frankly is just cool.  Bind mounts are a
> really neat VFS feature.

I will personally always be nervous until something like this happens:

http://thread.gmane.org/gmane.linux.kernel.lsm/10659

execve() is IMO scary.

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ