public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Madore <david.madore@ens.fr>
To: Linux Kernel mailing-list <linux-kernel@vger.kernel.org>
Subject: Re: understanding Linux capabilities brokenness
Date: Tue, 9 Aug 2005 06:59:17 +0200	[thread overview]
Message-ID: <20050809045916.GA3157@clipper.ens.fr> (raw)
In-Reply-To: <20050809015048.GA14204@thunk.org>

On Tue, Aug 09, 2005 at 01:53:50AM +0000, Theodore Ts'o wrote:
> The POSIX specification for capabilities requires filesystem support,
> so that each executables can be marked with three capability sets ---
> which indicate which capabilities are asserted when the executable
> starts, which capabilities the executable is allowed to request, and
> which capabilities the executable is allowed to inherit from its
> parent process.  This effectively takes a single setuid bit and splits
> it into a hundred-odd bits.  

You point out various reasons why the POSIX (draft-)specification is
problematic.  But nobody says Linux has to abide it, especially as it
is a mere withdrawn draft.  Solaris 10 has capabilities (except that
they're called "privileges") which are similar, but not identical, to
the POSIX ones.

And even capabilities with no filesystem support can be useful.  In
fact, as far as I see it, the main interest in capabilities lies in
the "process management" part.  For example, I might like to run this
or that binary, which claims it needs to be run as root, with a
limited set of capabilities: the current Linux kernels make this quite
impossible.  Conversely, I might wish to give a particular capability
to a given user; in association with sudo, this might be quite useful:
instead of telling sudo to let the user run a given command as root,
just let him run a capability-aware wrapper which drops every
capability except the required ones and then calls the actual program
- so even if the latter is not secure, damage is more limited.  I can
think of thousands of other uses not requiring any kind of filesystem
support.

>					    Note that many some setuid
> programs don't necessarily check error returns, and sometimes turning
> off permissions can sometimes open up vulnerabilities.

Yes, the sendmail vulnerability proved this quite clearly.  So
certainly a luser should not be permitted to run a suid root program
with anything in between the empty set and the full set of
capabilities.

> Another problem with the POSIX capabilities is that most of the
> programs that system administrators run to look for setuid programs
> will miss programs that have capabilities encoded in extended
> attributes.  This problem could be fixed by requiring the setuid bit
> to be set before paying attention to the capability EA's; but this
> could lead to surprising results if the filesystem is mounted on a
> system that doesn't use filesystem capabilities at all.

I might suggest encoding the presence of capabilities by a sgid bit
for a specific group (say, wheel) on top of the extended attributes.
So the careful sysadmin will notice the programs (because sgid wheel
is significant enough to be noted) but it will not cause total
disaster if mounted on a non-capability-capable ;-) filesystem.

> Yet another issue is that the POSIX capabilities model means that a
> default executable, such as gcc for example, is not allowed to inherit
> _any_ capabilities, even if it is run from a setuid root shell.  This
> is good from a security point of view, since it means that people
> can't get in trouble by doing silly things like typing
> "./configure;make" as root and expect any of the build tools to have
> override arbitrary file controls.  The bad news is that system
> administrators aren't particularly happy when their own private tools
> have to especially marked to allow them to run with elevated
> privileges.

Yes, this seems like a reason to deviate from the POSIX model under
Linux.

-- 
     David A. Madore
    (david.madore@ens.fr,
     http://www.madore.org/~david/ )

  parent reply	other threads:[~2005-08-09  4:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-08 21:12 understanding Linux capabilities brokenness David Madore
2005-08-08 22:32 ` David Madore
2005-08-08 23:53   ` David Wagner
2005-08-09  1:50     ` Theodore Ts'o
2005-08-09  4:46       ` James Morris
2005-08-09  8:09         ` Jan Engelhardt
2005-08-09 15:16         ` Christopher Warner
2005-08-09 20:20           ` Kyle Moffett
2005-08-09  4:59       ` David Madore [this message]
2005-08-09  5:53         ` James Morris

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=20050809045916.GA3157@clipper.ens.fr \
    --to=david.madore@ens.fr \
    --cc=linux-kernel@vger.kernel.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