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]
Message-ID: <CALCETrV29STWueUTTttN5e8t0ee-QO3iVv43m05YJJ6AP2Qa+A@mail.gmail.com>
Date:	Wed, 4 Feb 2015 08:27:19 -0800
From:	Andy Lutomirski <luto@...capital.net>
To:	"Serge E. Hallyn" <serge@...lyn.com>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...uxfoundation.org>,
	Aaron Jones <aaronmdjones@...il.com>,
	LSM List <linux-security-module@...r.kernel.org>,
	"Ted Ts'o" <tytso@....edu>, Serge Hallyn <serge.hallyn@...ntu.com>,
	"Andrew G. Morgan" <morgan@...nel.org>,
	Christoph Lameter <cl@...ux.com>,
	Serge Hallyn <serge.hallyn@...onical.com>,
	Jonathan Corbet <corbet@....net>
Subject: Re: [capabilities] Allow normal inheritance for a configurable set of capabilities

On Feb 4, 2015 7:56 AM, "Serge E. Hallyn" <serge@...lyn.com> wrote:
>
> Quoting Christoph Lameter (cl@...ux.com):
> > On Wed, 4 Feb 2015, Andrew G. Morgan wrote:
> >
> > > I'm not generally in favor of this. Mostly because this seems to be a
> > > mini-root kind of inheritance that propagates privilege to binaries
> > > that aren't prepared for privilege. I don't really buy the mmap code
> > > concern because the model as it stands says that you trust the binary
> > > (and all of the various ways it was programmed to execute code) with
> > > specific privileges. If the binary mmap's some code (PAM modules come
> > > to mind) then that is part of what it was programmed to/allowed to do.
> > >
> > > That being said, if you really really want this kind of thing, then
> > > make it a single secure bit (with another lock on/off bit) which, when
> > > set, makes: fI default to X.
> > >
> > >    pP' = (X & fP) | (pI & fI)
> > >
> > > That way the per-process bounding set still works as advertised and
> > > you don't need to worry about the existing semantics being violated.
> >
> > Ok but then also fI needs to be set to X so that the binary f invokes
> > can also inherit.  So if we copy the inheritable flags to fI then we
> > wont be needing the bounding set anymore.
> >
> > The changes to brpm_caps_from_vfs_cap would then
> > be only the following? (substitute capable(CAP_INHERIT_BY_DEFAULT through
> > any other means like PRCTL if wanted).
> >
> >
> > Index: linux/security/commoncap.c
> > ===================================================================
> > --- linux.orig/security/commoncap.c   2015-02-04 09:44:25.000000000 -0600
> > +++ linux/security/commoncap.c        2015-02-04 09:45:59.381572756 -0600
> > @@ -350,6 +350,9 @@ static inline int bprm_caps_from_vfs_cap
> >               __u32 permitted = caps->permitted.cap[i];
> >               __u32 inheritable = caps->inheritable.cap[i];
> >
> > +             if (capable(CAP_INHERIT_BY_DEFAULT)
> > +                     new->cap_inheritable.cap[i] = inheritable;
> > +
> >               /*
> >                * pP' = (X & fP) | (pI & fI)
> >                */
>
> Not quite - I think more like
>
>         if (secure(SECURE_AMBIENT_PRIVS))
>                 new->cap_inheritable.cap[i] = inheritable;

I *still* think this should be inheritable & permitted.

>
> Then ns_capable(CAP_INHERIT_BY_DEFAULT), or perhaps rather
> ns_capable(CAP_SETPCAP), would be required in order to set
> SECURE_AMBIENT_PRIVS, which is off by default.

Can we make this depend on no_new_privs instead of a new cap?  I don't
want to see people leaking this securebit into the environment for
reasons they think are good a la CVE-2014-3215.  I sincerely doubt
that running, say, sendmail or exim with this bit set and no_new_privs
off is a good idea.

Hmm.  On an unrelated note, we should consider allowing no_new_privs
to be cleared in conjunction with unsharing userns.

--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