From: Karl MacMillan <kmacmillan@mentalrootkit.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Chad Sellers <csellers@tresys.com>,
selinux@tycho.nsa.gov, James Morris <jmorris@namei.org>,
Eric Paris <eparis@parisplace.org>,
"Serge E. Hallyn" <serue@us.ibm.com>
Subject: Re: [RFC][PATCH] selinux: enable authoritative granting of capabilities
Date: Thu, 14 Jun 2007 12:13:53 -0400 [thread overview]
Message-ID: <1181837633.14725.56.camel@localhost.localdomain> (raw)
In-Reply-To: <1181836985.17547.645.camel@moss-spartans.epoch.ncsc.mil>
On Thu, 2007-06-14 at 12:03 -0400, Stephen Smalley wrote:
> On Thu, 2007-06-14 at 11:55 -0400, Stephen Smalley wrote:
> > On Thu, 2007-06-14 at 11:40 -0400, Chad Sellers wrote:
> > > On 6/12/07 9:32 AM, "Stephen Smalley" <sds@tycho.nsa.gov> wrote:
> > >
> > > > On Mon, 2007-06-11 at 15:55 -0400, Stephen Smalley wrote:
> > > >> Extend SELinux to allow capabilities to be granted authoritatively.
> > > >> Introduces a new cap_override access vector to indicate when the
> > > >> secondary module (i.e. capability or dummy) check should be skipped.
> > > >> Handle the new class gracefully even if the policy does not yet have
> > > >> it defined.
> > > >
> > > > Ah, I realized that this has the same issue in permissive mode as the
> > > > get_user_sids code - we don't want to arbitrarily allow these
> > > > dac_override permissions in permissive mode (otherwise setenforce 0
> > > > turns off DAC as well), so the following patch should be applied on top:
> > > >
> > > > diff -u b/security/selinux/hooks.c b/security/selinux/hooks.c
> > > > --- b/security/selinux/hooks.c
> > > > +++ b/security/selinux/hooks.c
> > > > @@ -1424,7 +1424,7 @@
> > > > int rc;
> > > >
> > > > rc = avc_has_perm_noaudit(sid, sid, SECCLASS_CAP_OVERRIDE,
> > > > - CAP_TO_MASK(cap), 0, NULL);
> > > > + CAP_TO_MASK(cap), AVC_STRICT, NULL);
> > > > if (rc) {
> > > > rc = secondary_ops->capable(tsk, cap);
> > > > if (rc)
> > > >
> > > > I'll fold that into the base patch for submission.
> > >
> > > This certainly makes the permissive case better than the original patch, but
> > > you're still opening up a new vector for escalation of privilege when
> > > SELinux access controls aren't enforcing. At the very least, policy authors
> > > are going to have to be really careful with this, as it's easy to shoot
> > > yourself in the foot in permissive. One example scenario of escalation:
> > >
> > > A domain is granted cap_override:dac_override in policy. The system is
> > > running in permissive mode. In permissive mode, the only thing that protects
> > > the policy from being reloaded is DAC permissions, which the policy has
> > > granted the domain the ability to override. So, the domain loads a new
> > > policy which grants it cap_override:*. This means that in permissive
> > > dac_override can easily get you all capabilities. Also, note that the same
> > > scenario can be constructed without the original allow rule using a
> > > capability shedding scenario.
> > >
> > > I realize that there are already other scenarios where a program can use
> > > dac_override to escalate to further capabilities. My point is that we seem
> > > to be opening up a new attack vector here.
> >
> > Actually, we don't want the cap_overrides to take affect at all under
> > permissive mode, since permissive mode is generally about avoiding side
> > effects from SELinux permission checks and we lose any inter-domain
> > protection in permissive mode (thus unprivileged domain could take
> > control of domain with cap_overrides). So we would need to restrict the
> > override logic to enforcing mode only.
>
> Like so:
>
This is certainly safer, but it is going to be surprising and make
permissive hard to use for testing. Basically - you would have to make
some executables setuid while developing policy in permissive and remove
setuid when you move to enforcing (unless I'm missing something). Or I
guess you could run the apps under a different uid so that it would
inherit the right capabilities, which introduces a whole other set of
side-effects.
Karl
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
next prev parent reply other threads:[~2007-06-14 16:13 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-11 19:55 [RFC][PATCH] selinux: enable authoritative granting of capabilities Stephen Smalley
2007-06-11 20:39 ` James Morris
2007-06-11 20:43 ` Serge E. Hallyn
2007-06-11 21:43 ` Casey Schaufler
2007-06-11 22:20 ` James Morris
2007-06-12 0:00 ` Casey Schaufler
2007-06-12 11:46 ` Stephen Smalley
2007-06-11 22:24 ` Serge E. Hallyn
2007-06-12 9:20 ` Russell Coker
2007-06-12 15:44 ` Serge E. Hallyn
2007-06-12 15:57 ` Stephen Smalley
2007-06-13 11:16 ` Russell Coker
2007-06-13 12:31 ` Stephen Smalley
2007-06-14 9:44 ` Russell Coker
2007-06-14 11:03 ` Stephen Smalley
2007-06-14 14:50 ` Stephen Smalley
2007-06-14 14:54 ` Joshua Brindle
2007-06-14 13:54 ` Casey Schaufler
2007-06-14 14:50 ` Joshua Brindle
2007-06-14 15:05 ` Stephen Smalley
2007-06-12 11:43 ` Stephen Smalley
2007-06-12 11:31 ` Stephen Smalley
2007-06-12 9:27 ` Russell Coker
2007-06-12 12:09 ` Stephen Smalley
2007-06-12 12:50 ` Stephen Smalley
2007-06-12 15:08 ` Casey Schaufler
2007-06-12 15:33 ` Stephen Smalley
2007-06-12 16:38 ` Casey Schaufler
2007-06-12 17:49 ` James Morris
2007-06-12 19:56 ` Casey Schaufler
2007-06-12 16:03 ` Serge E. Hallyn
2007-06-12 13:24 ` Stephen Smalley
2007-06-12 20:50 ` Stephen Smalley
2007-06-12 21:12 ` Stephen Smalley
2007-06-13 14:31 ` Stephen Smalley
2007-06-13 15:06 ` Christopher J. PeBenito
2007-06-13 15:28 ` Stephen Smalley
2007-06-13 18:46 ` Christopher J. PeBenito
2007-06-13 19:20 ` Stephen Smalley
2007-06-14 19:19 ` Christopher J. PeBenito
2007-06-15 11:50 ` Stephen Smalley
2007-06-13 19:10 ` Eric Paris
2007-06-13 19:22 ` Stephen Smalley
2007-06-13 19:50 ` Daniel J Walsh
2007-06-13 20:00 ` Stephen Smalley
2007-06-13 20:22 ` Daniel J Walsh
2007-06-12 13:32 ` Stephen Smalley
2007-06-14 15:40 ` Chad Sellers
2007-06-14 15:55 ` Stephen Smalley
2007-06-14 16:03 ` Stephen Smalley
2007-06-14 16:13 ` Karl MacMillan [this message]
2007-06-14 16:52 ` James Morris
2007-06-14 17:28 ` Chad Sellers
2007-06-14 17:35 ` James Morris
2007-06-14 17:43 ` Chad Sellers
2007-06-14 17:47 ` Stephen Smalley
2007-06-14 20:02 ` Casey Schaufler
2007-06-14 17:46 ` Stephen Smalley
2007-06-14 18:18 ` James Morris
2007-06-14 15:55 ` Karl MacMillan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1181837633.14725.56.camel@localhost.localdomain \
--to=kmacmillan@mentalrootkit.com \
--cc=csellers@tresys.com \
--cc=eparis@parisplace.org \
--cc=jmorris@namei.org \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
--cc=serue@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.