From: Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>
To: "Andrew G. Morgan" <morgan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Jarkko Sakkinen
<jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
Ted Ts'o <tytso-3s7WtUTddSA@public.gmane.org>,
Andrew Lutomirski <luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Andrew Morton
<akpm-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
Michael Kerrisk
<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Mimi Zohar
<zohar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>,
Linux API <linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Austin S Hemmelgarn
<ahferroin7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-security-module
<linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Aaron Jones
<aaronmdjones-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Christoph Lameter <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>,
LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Serge Hallyn
<serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>,
Markku Savela <msa-kXoF896ld44xHbG02/KK1g@public.gmane.org>,
Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
Jonathan Corbet <corbet-T1hC0tSOHrs@public.gmane.org>
Subject: Re: [RFC] capabilities: Ambient capabilities
Date: Sat, 14 Mar 2015 15:53:27 -0700 [thread overview]
Message-ID: <CALCETrXC7oZnbXas10gat2MCZGFQfNchSeCaZTMRvq5NoPLZHw@mail.gmail.com> (raw)
In-Reply-To: <CALQRfL6z2dEtPkWiuGydT0a+y4iWm2qw-cY0Rk9hA-K4gPw_qA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Sat, Mar 14, 2015 at 3:17 PM, Andrew G. Morgan <morgan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Sat, Mar 14, 2015 at 2:45 PM, Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org> wrote:
>> On Sat, Mar 14, 2015 at 2:09 PM, Andrew G. Morgan <morgan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>>> On Fri, Mar 13, 2015 at 10:57 AM, Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org> wrote:
>>>> On Mar 13, 2015 6:24 AM, "Andrew G. Morgan" <morgan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>>>>>
>>>>> > It's to preserve the invariant that pA is always a subset of pI.
>>>>>
>>>>> But since a user can always raise a bit in pI if it is present in pP,
>>>>> what does this invariant add to your model other than inconvenience?
>>>>
>>>> The useful part is that dropping a bit from pI also drops it from pA.
>>>> To keep the model consistent, I also require that you add the bit to
>>>> pI before adding it to pA.
>>>
>>> So you are saying that pA is always a strict subset of pI (and pP)?
>>> Then why not explicitly implement it as:
>>>
>>> pA' = (file caps or setuid or setgid ? 0 : pA)
>>> pP' = (fP & X) | (pI & [fI | (pA' & pP)] )
>>>
>>> As it is you have so distributed these constraints that it is hard to
>>> be sure it will remain that way.
>>
>> That would be insecure. If an attacker had pA = CAP_SYS_ADMIN, pI =
>> 0, pP = 0 (i.e. no privs but pA is set somehow) then, unless that's
>> there's some other protection implemented, they could run some setuid
>> program, and that program could switch back to non-root, set pI = 0,
>> and call execve. Unexpectedly, CAP_SYS_ADMIN would be inherited.
>
> Forgive me, but which bit of
>
> pI & [fI | (pA' & pP)]
>
> with pI = 0 makes that so?
Oh, I misread that.
I think it's already unnecessarily confusing that you can inherit
nonzero pI without inheriting the corresponding bits in pP, and I
don't want to add yet more degrees of freedom in non-permitted caps.
>>>>
>>>> I don't know what you mean here by naive privilege inheritance. The
>>>> examples you're taking about aren't inheritance at all; they're
>>>> exploring privilege *grants* during execve. My patch deliberately
>>>> leaves grants like that alone.
>>>
>>> The pI set is inherited through this exec unmolested.
>>
>> This is flat-out useless. Having pI = CAP_NET_BIND_SERVICE doesn't
>> let me bind low-numbered ports, full stop.
>
> Even in your proposed model, neither pI nor pA does this. It is what
> is in pE that counts.
Let me state it more precisely. If your parent puts
CAP_NET_BIND_SERVICE in pI and execs you, you can't bind low-numbered
ports. If your parent puts CAP_NET_BIND_SERVICE in pA, you can.
>
>>> My Nack remains that you are eliminating the explicit enforcement of
>>> selective inheritance. A lockable secure bit protecting access to your
>>> prctl() function would address this concern.
>>
>> Would a sysctl or securebit that *optionally* allows pA to be disabled
>> satisfy you?
>>
>> I don't understand why lockable is at all useful. You'd need
>> CAP_SETPCAP to flip it regardless.
>
> Because it means one can create process trees in which this behavior
> is guaranteed to be allowed and/or disallowed.
>
I don't see why guaranteeing that it's allowed is particularly useful.
I also don't see why any of the securebits lock bits are useful. I
don't specifically object; I just don't see the point. If you give a
subtree CAP_SETPCAP but you don't trust them enough to leave
securebits unlocked, then I think your threat model is confused.
--Andy
next prev parent reply other threads:[~2015-03-14 22:53 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-12 18:08 [RFC] capabilities: Ambient capabilities Andy Lutomirski
2015-03-12 21:49 ` Kees Cook
2015-03-12 22:10 ` Andrew G. Morgan
[not found] ` <CALQRfL7b8CjYgUnVy3jykNwv48fOc03T385RKo--cfv25YenBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-12 22:27 ` Andrew Lutomirski
[not found] ` <CAObL_7HgU-ekb7mJS7C=0=idfrzV6=CSqTrG2LvUgdDtvbJx_w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-13 13:24 ` Andrew G. Morgan
2015-03-13 16:06 ` Christoph Lameter
[not found] ` <alpine.DEB.2.11.1503131049150.13899-gkYfJU5Cukgdnm+yROfE0A@public.gmane.org>
2015-03-13 17:58 ` Andy Lutomirski
[not found] ` <CALCETrXcUfbqfm7av9crrxQ5nCBYpdJO8gRo4ZhRA97g27B2iw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-13 18:52 ` Christoph Lameter
2015-03-13 17:57 ` Andy Lutomirski
[not found] ` <CALCETrVz39pJmMAEFodBNA8cOZjd0xkH95EzMazY0MWJDtpYgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-13 18:52 ` Kees Cook
2015-03-13 19:03 ` Andy Lutomirski
[not found] ` <CALCETrV7vDJVhM_AgtGn8ENStcyxZBwCw3zhSn-whArT_XPg8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-13 19:54 ` Kees Cook
2015-03-14 21:09 ` Andrew G. Morgan
2015-03-14 21:45 ` Andy Lutomirski
[not found] ` <CALCETrUGASa3Gp6cC1zdAahcS59DOdyLnTtgNX7t7FucMZLmoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-14 22:17 ` Andrew G. Morgan
[not found] ` <CALQRfL6z2dEtPkWiuGydT0a+y4iWm2qw-cY0Rk9hA-K4gPw_qA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-14 22:53 ` Andy Lutomirski [this message]
2015-03-14 22:55 ` Andy Lutomirski
[not found] ` <CALCETrWRHRVLotFs=Cpdr=7KjE7q52NdT62GxZg=xjv+LFZBqw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-15 0:04 ` Andrew G. Morgan
2015-03-30 12:55 ` Christoph Lameter
[not found] ` <alpine.DEB.2.11.1503300754070.5031-gkYfJU5Cukgdnm+yROfE0A@public.gmane.org>
2015-03-30 14:31 ` Andy Lutomirski
[not found] ` <CALCETrW9ckw=7-1JSyFkenhFu2_1MvVqjA+inOmsuuWemGaU0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-30 15:05 ` Christoph Lameter
2015-04-09 15:25 ` Christoph Lameter
[not found] ` <alpine.DEB.2.11.1504091024540.13650-gkYfJU5Cukgdnm+yROfE0A@public.gmane.org>
2015-04-23 14:01 ` Christoph Lameter
[not found] ` <alpine.DEB.2.11.1504230900260.32203-gkYfJU5Cukgdnm+yROfE0A@public.gmane.org>
2015-04-24 17:53 ` Serge Hallyn
2015-04-24 18:41 ` Andy Lutomirski
[not found] ` <CALCETrW5_85mFFTkzCVNA5N1KQeNBrkw2d8FF3H3LYtmz6UAPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-24 19:09 ` Serge Hallyn
2015-04-24 19:25 ` Christoph Lameter
2015-04-24 19:53 ` Andy Lutomirski
2015-04-24 20:13 ` Christoph Lameter
[not found] ` <alpine.DEB.2.11.1504241512570.11839-gkYfJU5Cukgdnm+yROfE0A@public.gmane.org>
2015-04-24 20:18 ` Andy Lutomirski
2015-04-24 21:15 ` Serge E. Hallyn
[not found] ` <20150424211511.GB28613-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2015-04-24 22:55 ` Andy Lutomirski
[not found] ` <CALCETrUdNp18ZeOC8pRYn_YPUp8nFyH7aS+dFoBf34XNmER-nA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-25 2:45 ` Serge Hallyn
2015-04-27 14:55 ` Christoph Lameter
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=CALCETrXC7oZnbXas10gat2MCZGFQfNchSeCaZTMRvq5NoPLZHw@mail.gmail.com \
--to=luto-klttt9wpgjjwatoyat5jvq@public.gmane.org \
--cc=aaronmdjones-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ahferroin7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=akpm-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org \
--cc=corbet-T1hC0tSOHrs@public.gmane.org \
--cc=jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=morgan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=msa-kXoF896ld44xHbG02/KK1g@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
--cc=tytso-3s7WtUTddSA@public.gmane.org \
--cc=zohar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).