From: Aleksa Sarai <asarai@suse.de>
To: Andy Lutomirski <luto@amacapital.net>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
Andrew Morton <akpm@linux-foundation.org>,
Alexey Dobriyan <adobriyan@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Aleksa Sarai <cyphar@cyphar.com>,
dev@opencontainers.org, Linux API <linux-api@vger.kernel.org>,
Linux Containers <containers@lists.linux-foundation.org>
Subject: Re: [PATCH] groups: don't return unmapped gids in getgroups(2)
Date: Sat, 18 Feb 2017 04:53:59 +1100 [thread overview]
Message-ID: <6ab9118c-0476-99c8-cfbd-d3f5d378255e@suse.de> (raw)
In-Reply-To: <CALCETrVQou93PpYjKTtPGcs-uyYZ6T+v6j+5oy937GNXpKuP-A@mail.gmail.com>
>>>> One thing overlooked by commit 9cc46516ddf4 ("userns: Add a knob to
>>>> disable setgroups on a per user namespace basis") is that because
>>>> setgroups(2) no longer works in user namespaces it doesn't make any
>>>> sense to be returning weird group IDs that the process cannot do
>>>> anything with.
>>>
>>>
>
>> bool DropPrivileges()
>> {
>> /* ... */
>> // Verify that the user isn't still in any supplementary groups
>
> But the user *is* still in a supplementary group. Your proposed
> change would break the intent of this code.
I was about to say that "being in an unmapped supplementary group does
not count as privileges", but decided to test it first and realised that
this is not true? How is this not a blatant security vulnerability?
I understand the `chmod 707` usecase and that being able to *block*
access is useful with supplementary groups, but I would _never_ have
guessed that *unmapped* supplementary groups *allow you to have access
to files*.
And not only would I have never guessed that to be the case, this makes
the fact that getgroups(2) returns 65534 even _more_ concerning -- how
on earth is a userspace process meant to know what secret privileges it
has? How can it make sane decisions about security with this setup?
% touch somefile
% chmod 660 somefile
% sudo chown root:wheel somefile
% unshare -r
% cat somefile
% # no EACCES...
Please someone tell me this is a regression and it's not meant to be
this way...
--
Aleksa Sarai
Software Engineer (Containers)
SUSE Linux GmbH
https://www.cyphar.com/
next prev parent reply other threads:[~2017-02-17 17:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-16 17:47 Aleksa Sarai
2017-02-16 18:19 ` Eric W. Biederman
2017-02-17 8:44 ` Aleksa Sarai
2017-02-17 17:09 ` Andy Lutomirski
2017-02-17 17:53 ` Aleksa Sarai [this message]
2017-02-17 19:42 ` Mike Frysinger
2017-02-20 13:57 ` Djalal Harouni
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=6ab9118c-0476-99c8-cfbd-d3f5d378255e@suse.de \
--to=asarai@suse.de \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=containers@lists.linux-foundation.org \
--cc=cyphar@cyphar.com \
--cc=dev@opencontainers.org \
--cc=ebiederm@xmission.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
/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
all inboxes | Powered by JetHome®