lkml.org 
[lkml]   [2012]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Add PR_{GET,SET}_NO_NEW_PRIVS to prevent execve from granting privs
On 01/13/2012 07:09 AM, Kees Cook wrote:
> On Thu, Jan 12, 2012 at 10:02 PM, Andy Lutomirski <luto@amacapital.net> wrote:
>> On Thu, Jan 12, 2012 at 9:58 PM, Kees Cook <keescook@chromium.org> wrote:
>>> On Thu, Jan 12, 2012 at 6:12 PM, Andy Lutomirski <luto@amacapital.net> wrote:
>>>> With this set, a lot of dangerous operations (chroot, unshare, etc)
>>>> become a lot less dangerous because there is no possibility of
>>>> subverting privileged binaries.
>>>>
>>>> This patch completely breaks apparmor. Someone who understands (and
>>>> uses) apparmor should fix it or at least give me a hint.
>>>>
>>>> Signed-off-by: Andy Lutomirski <luto@amacapital.net>
>>>> [....]
>>>> diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
>>>> index c1e18ba..7f480b7 100644
>>>> --- a/security/apparmor/domain.c
>>>> +++ b/security/apparmor/domain.c
>>>> @@ -360,6 +360,9 @@ int apparmor_bprm_set_creds(struct linux_binprm *bprm)
>>>> if (bprm->cred_prepared)
>>>> return 0;
>>>>
>>>> + /* XXX: someone who understands apparmor needs to fix this. */
>>>> + BUG_ON(bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS);
>>>> +
>>>> cxt = bprm->cred->security;
>>>> BUG_ON(!cxt);
>>>>
>>>
>>> Since apparmor_bprm_set_creds() calls cap_bprm_set_creds() already[1],
>>> I think AppArmor needs no changes at all, but John will know better.
>>> :)
>>
>> I think that AppArmor determines what a program is allowed to do by
>> looking at the path of the executable. We don't want newly-executed
>> programs to gain permissions because they're a different executable
>> when we're in no_new_privs mode, so (if I'm right) something different
>> needs to happen.
>
> I'll have to go look more closely. I thought cap_bprm_set_creds() was
> already evaluating the new privs and blocking any gained privs with
> the changes you were making.
>
We do want to do something more. A first pass at it would be to allow execs
that inherit the current context, and we will also want to reject apparmor's
equiv of setcon, and setexeccon, at the interface.


\
 
 \ /
  Last update: 2012-01-13 08:31    [W:0.043 / U:2.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site