From: "Theodore Ts'o" <tytso@mit.edu>
To: Andy Lutomirski <luto@stanford.edu>
Cc: linux-kernel@vger.kernel.org, glasgow@beer.net,
albert@users.sourceforge.net
Subject: Re: posix capabilities inheritance
Date: Fri, 24 Oct 2003 08:41:50 -0400 [thread overview]
Message-ID: <20031024124150.GA5609@thunk.org> (raw)
In-Reply-To: <3F98E674.6090104@stanford.edu>
On Fri, Oct 24, 2003 at 01:44:36AM -0700, Andy Lutomirski wrote:
>
> 1. pI is currently almost useless. If a process really wants a capability
> to be dropped after exec, it can drop it itself. So redefine pI to mean
> "these are the only capabilities that this process or its children may
> _ever_ hold."
A lot of the reasons why it looks useless is because we don't have
filesystem support. The intent behind the POSIX capabilities system
is that system administrator can control which privileges are
conferred upon a program when it is exec'ed, as well as which
privileges it is allowed to inherit. (The idea behind this is that
even if the exec'ing process wishes to bequeath some super-user
capabilities across an exec, unless that program has been audited and
cleared by the site security officer as being cleared to accept that
additional capability, it shouldn't be given it.) In addition, of
course, the exec'ing process ought to be allowed to control what
capabilities it is willing to bequeth.
Hence the capabilities inheritance algorithm of:
pP' = fP | (fI & pI)
> 2. fE is useless. It doesn't seem to have much of a point, and it just
> adds complexity. (e.g. look at Windows privileges. they start unenabled,
> and programs have to jump through hoops to use them. I see no security
> benefit.) So remove fE entirely.
It has a lot of point. It's there for the same reason why just
because you have the root password, you don't want to run as root all
the time. (At least, sane people don't...) You might make mistakes.
A very basic rule of security is that you only use the least amount of
privileges to get the job done. That way, if you make a mistake, and
get tricked into accessing the wrong file (say, because you failed to
check for .. in pathnames supplied by an untrusted user), you limit
the amount of damage done because of your bone-headed mistake.
Is this more complexity? Yes. But security generally means more
complexity. Deal with it. If you don't like, it you can just always
run with fE set to fP, just as you just login as root and run with
root privileges all the time. As long as you're careful, and never
accidentally type the command rm -rf /, why bother with non-root
accounts on a single-user machine?
(And if you really need help answering that question, then let's just
agree to disagree, and remind me to never hire you to be a system
administrator on any of my machines....)
> 3. The current use of the capability bits is not as fine-grained as it
> could be, and lacks the ability to restrict normal users.
No. Bad, bad, bad, bad, bad idea.
A lot of the rules of when capabilities can be dropped and inherited
assume that capabilities enhance privileges, and do not take
privileges away. A very different calculus emerges when you start
restricting what a normal user can do, especially when this mixes with
setuid (non-root) or setgid programs. A lot of programs don't do
error checking, and if you can change basic assumptions of what works
and doesn't work, you can actually cause security breaches where none
previously existed.
One of the reasons why fP, fE, and fI are all set to zero was because
in a previous attempt to try to emulate capabilities, the old
"backwards compatibility" algorithm of how to treat setuid root
programs allowed the exec'ing process to control what privileges could
be inherited by a setuid root program. This was really bad, since it
meant that a setuid root program could have some capabilities (such as
filesystem descretionary access controls override), but not others,
and a failure to check error returns (since after all a setuid root
program would *always* succeed, right?), caused a security hole.
It is for similar reasons that chroot requires root privileges. One
might think that restricting what part of the filesystem can be seen
by a process shouldn't require root privileges, except that by
changing the environment, it can fool setuid or setgid programs into
doing the wrong thing.
So any scheme that restricts normal user privileges **must** have
different access controls and different semantics than schemes which
allow a process with superuser privileges from dropping some or all of
its capabilities. It's fundamentally a different thing, and should
not be conflated together. That way only lies madness. (And security
holes.)
- Ted
next prev parent reply other threads:[~2003-10-24 12:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <fa.n4rmmgg.2423pm@ifi.uio.no>
[not found] ` <fa.l1oevhb.1s5k583@ifi.uio.no>
2003-10-24 8:44 ` posix capabilities inheritance Andy Lutomirski
2003-10-24 12:41 ` Theodore Ts'o [this message]
2003-10-24 16:44 ` Andy Lutomirski
2003-10-24 20:58 ` David Wagner
[not found] <fa.f26d55g.1qgijbi@ifi.uio.no>
[not found] ` <fa.hq0dft9.9i0obd@ifi.uio.no>
2003-10-24 21:24 ` Andy Lutomirski
[not found] <fa.f4bs2b4.fhub0m@ifi.uio.no>
2003-10-23 22:05 ` Michael Glasgow
2003-10-23 22:59 ` Theodore Ts'o
2003-10-24 1:36 ` Ernie Petrides
2003-10-24 2:19 ` Bernd Eckenfels
2003-10-24 5:10 ` Ernie Petrides
2003-10-25 19:51 ` Pavel Machek
2003-10-23 1:41 Albert Cahalan
[not found] <fa.f9mv0tb.27sf3j@ifi.uio.no>
2003-10-23 1:36 ` Michael Glasgow
2003-10-23 1:57 ` Andy Lutomirski
[not found] <fa.f36f4t9.1rg8j3v@ifi.uio.no>
2003-10-22 7:11 ` Michael Glasgow
2003-10-22 19:40 ` Andy Lutomirski
[not found] <fa.hehull9.10mmngt@ifi.uio.no>
2003-10-21 18:24 ` Andy Lutomirski
-- strict thread matches above, loose matches on Subject: below --
2003-10-21 11:26 Michael Glasgow
2003-10-23 16:46 ` Theodore Ts'o
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=20031024124150.GA5609@thunk.org \
--to=tytso@mit.edu \
--cc=albert@users.sourceforge.net \
--cc=glasgow@beer.net \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@stanford.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.