From: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
To: "Michael Kerrisk (man-pages)"
<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Krzysztof Adamski <k@japko.eu>,
linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] execve.2: EPERM from filesystem capabilities.
Date: Mon, 4 Apr 2016 23:25:01 -0400 [thread overview]
Message-ID: <20160405032501.GD6588@vapier.lan> (raw)
In-Reply-To: <56E0C0C3.6040808-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 3853 bytes --]
On 10 Mar 2016 01:33, Michael Kerrisk (man-pages) wrote:
> Okay -- I got it at last. I think the explanation requires quite
> some detail. I added this to execve(2):
>
> EPERM A "capability-dumb" applications would not obtain the
> full set of permitted capabilities granted by the exe‐
> cutable file. See capabilities(7).
this sounds wrong for multiple reasons:
- "A applications" doesn't make sense ... making "application" singular
seems to be the most logical step
- it should be "could not obtain" instead of "would not obtain"
- the cap part sounds confusing/misleading to me -- filesystem based caps
can modify the effective, inheritable, or permitted set
- calling them "capability-dumb" is prejudicial ... see below
how about:
An application with capabilities attached via the filesystem was unable
to update the capability sets. See capabilities(7).
> And this to capabilities(7):
>
> Safety checking for capability-dumb binaries
> A capability-dumb binary is a legacy application that has been
> marked to have file capabilities, but has not been converted to
> use the libcap(3) API to manipulate its capabilities. (In
> other words, this is a traditional set-user-ID-root program
> that has been switched to use file capabilities, but whose code
> has not been modified to understand capabilities.) For such
> applications, the effective capability bit is set on the file,
> so that the file permitted capabilities are automatically
> enabled in the process effective set when executing the file.
> The kernel recognizes a file which has the effective capability
> bit set as capability-dumb for the purpose of the check
> described here.
this text makes it sound like using filesystem caps is always wrong when
in reality it's quite a desirable feature. let's look at ping since that
is what spawned this thread.
historically, the only way to make `ping` usable by non-root users was
to make it setuid. this left admins with an ugly choice: non-root users
didn't get ping access, or they had to mark a networking binary setuid.
historically admins/distros just made it setuid.
the ping authors tried to make this less of a security issue by adding
logic to drop root during most of its execution and only grab it again
when trying to create the raw socket. but still, the program could be
abused because it's setuid.
libcap comes into play as a way to more selectively drop caps *that it
already has*. even if ping is linked against libcap and makes calls to
it, it still must be granted the caps in the first place. which means
the program continues to be marked setuid, and there's still code that
can be abused (even if we manage to close the window a little bit).
with the introduction of filesystem caps, we now have an even better
option: the program is *not* marked setuid, but we do grant it the few
caps it needs to run. so even from the very first insn executed, the
kernel has guaranteed that all the other unrelated caps are dropped.
libcap is still orthogonal here: it's a method to manage caps you have
and could still be used to drop things once it's got the raw socket,
but it also still does not help for non-root users.
there is a side story specific to ping with later kernels wrt the new
IPPROTO_ICMP socket type, but that only worked for ICMP & IPv4. it
would be a few more years before IPv6 support was added. it also had
to be setup first with specific group ranges which made it a pita.
calling an application that uses filesystem capabilities "dumb" is like
calling every application that is marked setuid "dumb". it just doesn't
make sense.
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2016-04-05 3:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 19:45 [PATCH] execve.2: EPERM from filesystem capabilities Krzysztof Adamski
[not found] ` <20151012194506.GA6346-xLeyfSbClftGit24Ens98Q@public.gmane.org>
2016-03-09 0:49 ` Michael Kerrisk (man-pages)
[not found] ` <56DF7325.9030702-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-09 20:15 ` Krzysztof Adamski
[not found] ` <20160309201501.GE25658-xLeyfSbClftGit24Ens98Q@public.gmane.org>
2016-03-10 0:33 ` Michael Kerrisk (man-pages)
[not found] ` <56E0C0C3.6040808-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-10 15:06 ` Krzysztof Adamski
[not found] ` <20160310150633.GG25658-xLeyfSbClftGit24Ens98Q@public.gmane.org>
2016-03-10 17:07 ` Michael Kerrisk (man-pages)
2016-04-05 3:25 ` Mike Frysinger [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=20160405032501.GD6588@vapier.lan \
--to=vapier-abrp7r+bbdudnm+yrofe0a@public.gmane.org \
--cc=k@japko.eu \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).