Re: [PATCH PLACEHOLDER 1/3] fs/exec: "always_unprivileged" patch
|| ||Casey Schaufler <casey-AT-schaufler-ca.com> |
|| ||Andrew Lutomirski <luto-AT-mit.edu> |
|| ||Re: [PATCH PLACEHOLDER 1/3] fs/exec: "always_unprivileged" patch |
|| ||Sun, 15 Jan 2012 18:41:27 -0800|
|| ||Linus Torvalds <torvalds-AT-linux-foundation.org>,
Jamie Lokier <jamie-AT-shareable.org>,
Will Drewry <wad-AT-chromium.org>, linux-kernel-AT-vger.kernel.org,
pmoore-AT-redhat.com, eparis-AT-redhat.com, djm-AT-mindrot.org,
segoon-AT-openwall.com, rostedt-AT-goodmis.org, jmorris-AT-namei.org,
scarybeasts-AT-gmail.com, avi-AT-redhat.com, penberg-AT-cs.helsinki.fi,
viro-AT-zeniv.linux.org.uk, mingo-AT-elte.hu, akpm-AT-linux-foundation.org,
khilman-AT-ti.com, borislav.petkov-AT-amd.com, amwang-AT-redhat.com,
oleg-AT-redhat.com, ak-AT-linux.intel.com, eric.dumazet-AT-gmail.com,
gregkh-AT-suse.de, dhowells-AT-redhat.com, daniel.lezcano-AT-free.fr,
mhalcrow-AT-google.com, dlaor-AT-redhat.com, corbet-AT-lwn.net,
alan-AT-lxorguk.ukuu.org.uk, Casey Schaufler <casey-AT-schauf|
|| ||Article, Thread
On 1/15/2012 2:07 PM, Andrew Lutomirski wrote:
> On Sun, Jan 15, 2012 at 1:32 PM, Casey Schaufler<email@example.com> wrote:
>> On 1/15/2012 12:59 PM, Andrew Lutomirski wrote:
>>> On Sun, Jan 15, 2012 at 12:16 PM, Casey Schaufler
>>> <firstname.lastname@example.org> wrote:
>>>> On 1/14/2012 12:22 PM, Linus Torvalds wrote:
>>>>> And yes, I really seriously do believe that is both safer and simpler
>>>>> than some model that says "you can drop stuff", and then you have to
>>>>> start making up rules for what "dropping" means.
>>>>> Does "dropping" mean allowing setuid(geteuid()) for example? That *is*
>>>>> dropping the uid in a _POSIX_SAVED_IDS environment. And I'm saying
>>>>> that no, we should not even allow that. It's simply all too "subtle".
>>>> I am casting my two cents worth behind Linus. Dropping
>>>> privilege can be every bit as dangerous as granting privilege
>>>> in the real world of atrocious user land code. Especially in
>>>> the case of security policy enforcing user land code.
>>> Can you think of *any* plausible attack that is possible with my patch
>>> (i.e. no_new_privs allows setuid, setresuid, and capset) that would be
>>> prevented or even mitigated if I blocked those syscalls? I can't.
>>> (The sendmail-style attack is impossible with no_new_privs.)
>> I am notoriously bad at coming up with this sort of example.
>> I will try, I may not hit the mark, but it should be close.
>> The application is running with saved uid != euid when
>> no-new-privs is set. It execs a new binary, which keeps
>> the saved and effective uids. The program calls setreuid,
>> which succeeds. It opens the saved userid's files.
> If you don't trust that binary, then why are you execing it with saved
> uid != euid in the first place?
If I could trust the binary I wouldn't need your no_new_privs
semantics in the first place. Do you have any idea how big the
chrome browser binary is? You can't link it on a 32bit machine
it uses so much address space. On top of that, most modern
applications are compositions of scripts and interpreters built
on top of multiple layers of middleware. Of course I don't trust
> If you are setting no_new_privs, then
> you are new code and should have at least some basic awareness of the
It's not the program setting no_new_privs that I'm worried about.
It's the nth descendant of that program and its ancestors that are
going to do screwy things.
> The exact same "exploit" is possible if you have
> CAP_DAC_OVERRIDE with either no_new_privs semantics -- if you have a
> privilege and you run untrusted code, then you had better remove that
> privilege somehow for the untrusted code.
Yes, and my very own name is engraved on the security wall of shame
for the classic sendmail capabilities exploit. Don't think for a
minute that something won't get done just because its obviously
> IOW, *drop privileges if you are a sandbox*. Otherwise you're screwed
> with or without no_new_privs.
> Another way of saying this is: no_new_privs is not a sandbox. It's
> just a way to make it safe for sandboxes and other such weird things
> processes can do to themselves safe across execve. If you want a
> sandbox, use seccomp mode 2, which will require you to set
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to email@example.com
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to firstname.lastname@example.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
to post comments)