|
Message-ID: <87zhi050ep.fsf@oldenburg2.str.redhat.com> Date: Wed, 16 Oct 2019 14:40:14 +0200 From: Florian Weimer <fweimer@...hat.com> To: Rich Felker <dalias@...c.org> Cc: Joshua Hudson <joshudson@...il.com>, musl@...ts.openwall.com Subject: Re: Re: posix_spawn * Rich Felker: > On Tue, Oct 01, 2019 at 09:05:18AM +0200, Florian Weimer wrote: >> * Rich Felker: >> >> > This is not safe and creates a false sense that something broken might >> > work. Moreover it's a vulnerability to use it this way. You have a >> > window where different tasks sharing VM space are executing with >> > different privilege levels, and thereby one is able to seize execution >> > of the other and achieve its privilege level. >> >> That's a non-sequitur. A shared address space does not necessarily mean >> that execution under one set of credentials will have unrestricted >> effects on executions under different credentials within the same >> address space. > > It does, but not necessarily in all circumstances. The case in which > is it dangerous is when one of the tasks is "dropping privileges" > before executing code that either intentionally (e.g. a login session, > script interpreter, etc. acting behalf of the new user) or > unintentionally (because the code after dropping privileges is not as > heavily scrutinized and has a vulnerability) lets the attacker execute > code they control. In that case, the now-attacker-controlled task can > perform operations on the VM space of the privileged task, e.g. using > mmap to replace the code it's executing with whatever it wants. I'm still not convinced, sorry. setuid to a lower-privileged user does not give that user access to the process. Linux has an independent flag for that, and if you want to grant that level of access to an existing process, you have to set it explicitly. Sharing address space is just a tiny aspect here. If the process contains secrets (and some people would consider just the load address such a secret, especially with forking server processes), exposing it to other users could be problematic, even if there is no address space sharing involved. I don't understand the focus on setuid, to be honest. In practice, there are things that are much more dangerous for privileged processes (such as chroot or even chdir, or just plain old open). I'm not arguing for the sake of it, your skepticism (or should I say objection) probably blocks acceptance of my glibc patches in this area. (I think you mentioned that on libc-alpha at one point at least.) Just to reiterate, my motivation comes from analyzing actual system call usage in existing file servers (Samba and nfs-ganesha). They use per-thread credentials (via direct system calls to change the effective IDs) and a per-thread current directory (via unshare (CLONE_FS)). So in a sense, all we can do at this point is harm reduction by providing documented interfaces which spell out their limitations. Thanks, Florian
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.