mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Rich Felker <dalias@libc.org>
Cc: Joshua Hudson <joshudson@gmail.com>,  musl@lists.openwall.com
Subject: Re: Re: posix_spawn
Date: Wed, 16 Oct 2019 14:40:14 +0200	[thread overview]
Message-ID: <87zhi050ep.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <20191001114246.GC16318@brightrain.aerifal.cx> (Rich Felker's message of "Tue, 1 Oct 2019 07:42:46 -0400")

* 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


      parent reply	other threads:[~2019-10-16 12:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-30 21:15 posix_spawn Joshua Hudson
2019-09-30 22:36 ` posix_spawn Rich Felker
2019-10-01  1:58   ` Joshua Hudson
2019-10-01  2:21     ` Rich Felker
2019-10-01  2:41       ` Joshua Hudson
2019-10-01  2:55         ` Rich Felker
2019-10-01  7:05           ` Florian Weimer
2019-10-01 11:42             ` Rich Felker
2019-10-01 14:07               ` posix_spawn Joshua Hudson
2019-10-01 14:15                 ` posix_spawn Florian Weimer
2019-10-01 14:44                   ` posix_spawn Rich Felker
2019-10-01 15:06                     ` Rich Felker
2019-10-16 12:40               ` Florian Weimer [this message]

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=87zhi050ep.fsf@oldenburg2.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=dalias@libc.org \
    --cc=joshudson@gmail.com \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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