All of lore.kernel.org
 help / color / mirror / Atom feed
From: Casey Schaufler <casey@schaufler-ca.com>
To: "Serge E. Hallyn" <serue@us.ibm.com>,
	Stephen Smalley <sds@tycho.nsa.gov>
Cc: "Serge E. Hallyn" <serue@us.ibm.com>,
	Crispin Cowan <crispin@crispincowan.com>,
	Mark Nelson <markn@au1.ibm.com>,
	containers@lists.linux-foundation.org,
	linux-security-module@vger.kernel.org,
	James Morris <jmorris@namei.org>,
	selinux@tycho.nsa.gov, menage@google.com
Subject: Re: [PATCH 1/2] namespaces: introduce sys_hijack (v10)
Date: Tue, 27 Nov 2007 14:54:26 -0800 (PST)	[thread overview]
Message-ID: <85084.30222.qm@web36605.mail.mud.yahoo.com> (raw)
In-Reply-To: <20071127223829.GA21753@sergelap.austin.ibm.com>


--- "Serge E. Hallyn" <serue@us.ibm.com> wrote:

> Quoting Stephen Smalley (sds@tycho.nsa.gov):
> > On Tue, 2007-11-27 at 10:11 -0600, Serge E. Hallyn wrote:
> > > Quoting Crispin Cowan (crispin@crispincowan.com):
> > > > Just the name "sys_hijack" makes me concerned.
> > > > 
> > > > This post describes a bunch of "what", but doesn't tell us about "why"
> > > > we would want this. What is it for?
> > > 
> > > Please see my response to Casey's email.
> > > 
> > > > And I second Casey's concern about careful management of the privilege
> > > > required to "hijack" a process.
> > > 
> > > Absolutely.  We're definately still in RFC territory.
> > > 
> > > Note that there are currently several proposed (but no upstream) ways to
> > > accomplish entering a namespace:
> > > 
> > > 	1. bind_ns() is a new pair of syscalls proposed by Cedric.  An
> > > 	nsproxy is given an integer id.  The id can be used to enter
> > > 	an nsproxy, basically a straight current->nsproxy = target_nsproxy;
> > > 
> > > 	2. I had previously posted a patchset on top of the nsproxy
> > > 	cgroup which allowed entering a nsproxy through the ns cgroup
> > > 	interface.
> > > 
> > > There are objections to both those patchsets because simply switching a
> > > task's nsproxy using a syscall or file write in the middle of running a
> > > binary is quite unsafe.  Eric Biederman had suggested using ptrace or
> > > something like it to accomplish the goal.
> > > 
> > > Just using ptrace is however not safe either.  You are inheriting *all*
> > > of the target's context, so it shouldn't be difficult for a nefarious
> > > container/vserver admin to trick the host admin into running something
> > > which gives the container/vserver admin full access to the host.
> > 
> > I don't follow the above - with ptrace, you are controlling a process
> > already within the container (hence in theory already limited to its
> > container), and it continues to execute within that container.  What's
> > the issue there?
> 
> Hmm, yeah, I may have overspoken - I'm not good at making up exploits
> but while I see it possible to confuse the host admin by setting bogus
> environment, I guess there may not be an actual exploit.
> 
> Still after the fork induced through ptrace, we'll have to execute a
> file out of the hijacked process' namespaces and path (unless we get
> *really* 'exotic').  With hijack, execution continues under the caller's
> control, which I do much prefer.
> 
> The remaining advantages of hijack over ptrace (beside "using ptrace for
> that is crufty") are
> 
> 	1. not subject to pid wraparound (when doing hijack_cgroup
> 	   or hijack_ns)
> 	2. ability to enter a namespace which has no active processes
> 
> These also highlight selinux issues.  In the case of hijacking an
> empty cgroup, there is no security context (because there is no task) so
> the context of 'current' will be used.  In the case of hijacking a
> populated cgroup, a task is chosen "at random" to be the hijack source.
> 
> So there are two ways to look at deciding which context to use.  Since
> control continues in the original acting process' context, we might
> want the child to continue in its context.  However if the process
> creates any objects in the virtual server, we don't want them
> mislabeled, so we might want the task in the hijacked task's context.

I wouldn't be surprised if you've been over this a dozen times
already, but why hijack an existing process instead of injecting
a new one with completely specified attributes? That way you don't
distinguish between an empty cgroup and a propulated one and you're
not at the mercy of the available hijackees. I know that I would be
much less uncomfortable with that schenario.

> Sigh.  So here's why I thought I'd punt on selinux at least until I had
> a working selinux-enforced container/vserver  :)
> 
> -serge
> 
> PS: I'm certainly open to the suggestion that the kernel patch in the
> end us as crufty as using ptrace.
> 
> > > That's where the hijack idea came from.  Yes, I called it hijack to make
> > > sure alarm bells went off :) bc it's definately still worrisome.  But at
> > > this point I believe it is the safest solution suggested so far.
> > 
> > -- 
> > Stephen Smalley
> > National Security Agency
> > 
> > -
> > To unsubscribe from this list: send the line "unsubscribe
> linux-security-module" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-security-module" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 


Casey Schaufler
casey@schaufler-ca.com

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

  reply	other threads:[~2007-11-27 22:54 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-27  1:54 [PATCH 1/2] namespaces: introduce sys_hijack (v10) Mark Nelson
     [not found] ` <474B7A51.3080300@au1.ibm.com>
2007-11-27  5:04   ` [PATCH 2/2] hijack: update task_alloc_security Casey Schaufler
     [not found]     ` <820903.72193.qm-ua+PKVt9nRSvuULXzWHTWIglqE1Y4D90QQ4Iyu8u01E@public.gmane.org>
2007-11-27 16:01       ` Serge E. Hallyn
2007-11-27 16:01     ` Serge E. Hallyn
     [not found]       ` <20071127160127.GC32362-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-11-28  5:53         ` Crispin Cowan
2007-11-28 14:57           ` Serge E. Hallyn
     [not found]           ` <474D026B.3090306-RL8T2ARnKKfZw9hOtrW0rA@public.gmane.org>
2007-11-28 14:57             ` Serge E. Hallyn
2007-11-27  5:52   ` Joshua Brindle
     [not found]     ` <474BB095.8080302-PzTJMJMxY2mwxnkjfAeQoA@public.gmane.org>
2007-11-27 14:36       ` Stephen Smalley
2007-11-27 14:36         ` Stephen Smalley
2007-11-27 15:43         ` Serge E. Hallyn
     [not found]           ` <20071127154356.GA32362-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-11-28  5:50             ` Crispin Cowan
2007-11-28 14:54               ` Serge E. Hallyn
     [not found]                 ` <20071128145422.GC3820-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-11-29  4:21                   ` Crispin Cowan
     [not found]                 ` <474E3E4E.3060908@crispincowan.com>
2007-11-29 15:38                   ` Serge E. Hallyn
     [not found]                     ` <20071129153815.GA8140-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-12-02  1:07                       ` Crispin Cowan
     [not found]                     ` <47520568.6030108@crispincowan.com>
2007-12-03 14:50                       ` Serge E. Hallyn
     [not found]                         ` <20071203145012.GB9008-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-12-03 19:43                           ` Crispin Cowan
     [not found]                       ` <47520568.6030108-RL8T2ARnKKfZw9hOtrW0rA@public.gmane.org>
2007-12-03 14:50                         ` Serge E. Hallyn
     [not found]                   ` <474E3E4E.3060908-RL8T2ARnKKfZw9hOtrW0rA@public.gmane.org>
2007-11-29 15:38                     ` Serge E. Hallyn
     [not found]               ` <474D0188.2040600-RL8T2ARnKKfZw9hOtrW0rA@public.gmane.org>
2007-11-28 14:54                 ` Serge E. Hallyn
     [not found]         ` <1196174188.3925.32.camel-/ugcdrsPCSfIm9DtXLC9OUVfdvkotuLY+aIohriVLy8@public.gmane.org>
2007-11-27 15:43           ` Serge E. Hallyn
     [not found]   ` <474B7A51.3080300-8fk3Idey6ehBDgjK7y7TUQ@public.gmane.org>
2007-11-27  5:04     ` Casey Schaufler
2007-11-27  5:52     ` Joshua Brindle
     [not found] ` <474B78CB.5070607-8fk3Idey6ehBDgjK7y7TUQ@public.gmane.org>
2007-11-27  2:00   ` Mark Nelson
2007-11-27  6:58   ` [PATCH 1/2] namespaces: introduce sys_hijack (v10) Crispin Cowan
     [not found] ` <474BC017.6060801@crispincowan.com>
     [not found]   ` <474BC017.6060801-RL8T2ARnKKfZw9hOtrW0rA@public.gmane.org>
2007-11-27 16:11     ` Serge E. Hallyn
2007-11-27 16:11   ` Serge E. Hallyn
2007-11-27 18:09     ` Stephen Smalley
2007-11-27 22:38       ` Serge E. Hallyn
2007-11-27 22:54         ` Casey Schaufler [this message]
2007-11-28 14:25           ` Serge E. Hallyn
     [not found]           ` <85084.30222.qm-9MnE1aMSM06vuULXzWHTWIglqE1Y4D90QQ4Iyu8u01E@public.gmane.org>
2007-11-28 14:25             ` Serge E. Hallyn
     [not found]         ` <20071127223829.GA21753-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-11-27 22:54           ` Casey Schaufler
2007-11-28 15:00           ` Stephen Smalley
2007-11-28 15:00             ` Stephen Smalley
     [not found]             ` <1196262054.13820.23.camel-/ugcdrsPCSfIm9DtXLC9OUVfdvkotuLY+aIohriVLy8@public.gmane.org>
2007-11-28 15:23               ` Serge E. Hallyn
2007-11-28 15:23             ` Serge E. Hallyn
     [not found]               ` <20071128152359.GA4756-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-11-30  2:08                 ` Mark Nelson
     [not found]                   ` <474F70B3.5020006-8fk3Idey6ehBDgjK7y7TUQ@public.gmane.org>
2007-11-30  2:10                     ` Paul Menage
2007-11-30  2:37                     ` Eric W. Biederman
2007-11-30  2:37                       ` Eric W. Biederman
2007-11-30 14:50                       ` Serge E. Hallyn
2007-11-30 22:09                         ` Eric W. Biederman
     [not found]                         ` <20071130145016.GE6250-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-11-30 22:09                           ` Eric W. Biederman
     [not found]                       ` <m1wss0a27g.fsf-T1Yj925okcoyDheHMi7gv2pdwda3JcWeAL8bYrjMMd8@public.gmane.org>
2007-11-30 14:50                         ` Serge E. Hallyn
     [not found]                   ` <6599ad830711291810m463833ack452c375b552c627e@mail.gmail.com>
     [not found]                     ` <6599ad830711291810m463833ack452c375b552c627e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-11-30 14:50                       ` Serge E. Hallyn
2007-11-30 14:50                     ` Serge E. Hallyn
     [not found]       ` <1196186964.3925.129.camel-/ugcdrsPCSfIm9DtXLC9OUVfdvkotuLY+aIohriVLy8@public.gmane.org>
2007-11-27 22:38         ` Serge E. Hallyn
     [not found]     ` <20071127161132.GD32362-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-11-27 18:09       ` Stephen Smalley

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=85084.30222.qm@web36605.mail.mud.yahoo.com \
    --to=casey@schaufler-ca.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=crispin@crispincowan.com \
    --cc=jmorris@namei.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=markn@au1.ibm.com \
    --cc=menage@google.com \
    --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.