mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	gnomes@lxorguk.ukuu.org.uk, teg@jklm.no, jkosina@suse.cz,
	luto@amacapital.net, linux-kernel@vger.kernel.org,
	daniel@zonque.org, dh.herrmann@gmail.com, tixxdz@opendz.org
Subject: Issues with capability bits and meta-data in kdbus
Date: Tue, 21 Apr 2015 16:06:15 -0500	[thread overview]
Message-ID: <87oamhmbso.fsf_-_@x220.int.ebiederm.org> (raw)
In-Reply-To: <20150414175534.GB3974@kroah.com> (Greg Kroah-Hartman's message of "Tue, 14 Apr 2015 19:55:34 +0200")

Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:

> On Mon, Apr 13, 2015 at 07:19:49PM -0500, Eric W. Biederman wrote:
>> ebiederm@xmission.com (Eric W. Biederman) writes:
>> 
>> > And the code that transfers the meta-data is wrong.
>> 
>> In fact it is worse than I thought.
>
> Please see the email response I just wrote to Andy about this, it should
> address these misconceptions.

Nothing has changed my analysis of the kdbus code.

Hopefully now that I have made some semblance of getting some rest and
have a little bit of time I can explain the issues that I see.  I will
be focusing on user namespaces and capability bits as that is my area of
the kernel.

- The userspace interface for capability bits has a version number that
  determines the quantity and the meaning of the bits, kdbus does not
  pass that number to userspace.

- There is a well defined translation of capability bits between user
  namespaces kdbus does not perform that translation.

- Access to the capability bits is guarded with PTRACE_MAY_READ
  kdbus does not honor that and thus leaks information.

- Usage of the capability bits by userspace is a layering violation.

- The layering violation results in a privilege escalation (by
  definiton) whenever userspace uses the presence of the capability bits
  to allow anything.

- Another kind of privilege escalation happens when userspace makes a
  decision based on the abscense of in kernel capability bits.

The only safe way for userspace to use the kernel capability bits is to
decide which small handful of processes need the bits.  Let those
processes be what implements userspace policy and drop the capabilities
from everything else.

With bugs at every layer of the implementation stack from implementation
to design I concluded earlier that the code that transfers these
capabilities is not at all mature or ready to be merged.  Which is why I
asked for the code to be left for later until someone would pay
attention to it properly.


I will add that when playing with the unix security mechanism the design
has to be done very carefully, as the system is fragile and certain
kinds of changes modify existing tested designs into insecure code.  I
fail to see any of that kind of needed care being applied to the design
of the kdbus mechanisms.


My conclusion is that the design of the meta-data passing code is
fundamentally broken.  The issues I have observed with the kernel
capability bits apply to all of the other meta-data except that
meta-data that unix domain sockets already pass.  The privilege
escalation issues are fundamentally unfixable, and apply in general.

As this is fundamental to kdbus, kdbus is apparently fundmanetally
broken by design.

Eric

  reply	other threads:[~2015-04-21 21:10 UTC|newest]

Thread overview: 316+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 19:03 [GIT PULL] kdbus for 4.1-rc1 Greg Kroah-Hartman
2015-04-13 19:29 ` Eric W. Biederman
2015-04-13 19:42   ` Greg Kroah-Hartman
2015-04-13 19:49     ` Richard Weinberger
2015-04-13 19:54       ` Greg Kroah-Hartman
2015-04-13 19:57         ` Richard Weinberger
2015-04-13 20:03           ` Greg Kroah-Hartman
2015-04-13 20:08             ` Richard Weinberger
2015-04-13 20:22     ` Al Viro
2015-04-13 20:37       ` Greg Kroah-Hartman
2015-04-15  1:36       ` Andy Lutomirski
2015-04-15  6:54         ` Richard Weinberger
2015-04-15  7:31           ` Mike Galbraith
2015-04-15 14:48             ` Michal Schmidt
2015-04-15 15:34               ` Mike Galbraith
2015-04-15 16:42               ` Mike Galbraith
2015-04-17 16:53               ` Mike Galbraith
2015-04-15  8:48           ` Greg Kroah-Hartman
2015-04-15  9:00             ` Richard Weinberger
2015-04-15  9:20               ` Greg Kroah-Hartman
2015-04-15  9:21                 ` Borislav Petkov
2015-04-15  9:27                   ` Greg Kroah-Hartman
2015-04-15  9:30                     ` Richard Weinberger
2015-04-15  9:49                       ` Greg Kroah-Hartman
2015-04-15  9:53                         ` Richard Weinberger
2015-04-15  9:44                     ` Borislav Petkov
2015-04-15 11:40                       ` Greg Kroah-Hartman
2015-04-15 13:03                         ` Borislav Petkov
2015-04-15 15:41                         ` Steven Rostedt
2015-04-15 16:40                           ` Greg Kroah-Hartman
2015-04-15 16:48                             ` Jiri Kosina
2015-04-15 17:33                               ` Greg Kroah-Hartman
2015-04-15 18:06                                 ` Steven Rostedt
2015-04-16  8:43                                 ` Jiri Kosina
2015-04-15 17:20                             ` Steven Rostedt
2015-04-15 17:41                               ` Havoc Pennington
2015-04-15 17:55                               ` Greg Kroah-Hartman
2015-04-15 21:55                                 ` One Thousand Gnomes
2015-04-15 18:12                               ` Greg Kroah-Hartman
2015-04-15 19:04                         ` Martin Steigerwald
2015-04-15  9:28                 ` Richard Weinberger
2015-04-15 11:25             ` One Thousand Gnomes
2015-04-15 13:20               ` Borislav Petkov
2015-04-15 15:45               ` Steven Rostedt
2015-04-15 15:46                 ` Andy Lutomirski
2015-04-15 16:35                 ` Greg Kroah-Hartman
2015-04-15 17:06                   ` Steven Rostedt
2015-04-15 17:31                     ` Greg Kroah-Hartman
2015-04-15 18:04                       ` Steven Rostedt
2015-04-15 21:56                       ` One Thousand Gnomes
2015-04-15 22:11                         ` Andy Lutomirski
2015-04-15 22:18                           ` Al Viro
2015-04-15 22:28                             ` Andy Lutomirski
2015-04-15 22:48                               ` Al Viro
2015-04-15 22:54                                 ` Andy Lutomirski
2015-04-15 23:27                                   ` Al Viro
2015-04-16  0:47                                     ` Andy Lutomirski
2015-04-16  1:04                                       ` Al Viro
2015-04-16  5:53                                         ` Andy Lutomirski
2015-04-15 22:56                                 ` Eric Dumazet
2015-04-16 10:31                           ` Daniel Mack
2015-04-16 12:02                             ` Tom Gundersen
2015-04-16 12:15                               ` Olaf Hering
2015-04-16 12:43                                 ` Harald Hoyer
2015-04-21 16:36                               ` Eric W. Biederman
2015-04-21 19:38                                 ` Matthew Garrett
2015-04-21 19:55                                   ` Austin S Hemmelgarn
2015-04-15  8:18         ` Martin Steigerwald
2015-04-15  8:32           ` Greg Kroah-Hartman
2015-04-15  8:52             ` Martin Steigerwald
2015-04-15  9:02               ` Greg Kroah-Hartman
2015-04-15  9:28                 ` Martin Steigerwald
2015-04-15 11:52                   ` Greg Kroah-Hartman
2015-04-15  8:29         ` Greg Kroah-Hartman
2015-04-14  0:19   ` Eric W. Biederman
2015-04-14  0:34     ` Andy Lutomirski
2015-04-14 17:55     ` Greg Kroah-Hartman
2015-04-21 21:06       ` Eric W. Biederman [this message]
2015-04-22  1:30         ` Issues with capability bits and meta-data in kdbus Linus Torvalds
2015-04-22  1:54           ` Andy Lutomirski
2015-04-22  2:32             ` Linus Torvalds
2015-04-22  3:19               ` Andy Lutomirski
2015-04-22 13:46                 ` David Herrmann
2015-04-22 11:40               ` Austin S Hemmelgarn
2015-04-22 13:07                 ` Greg Kroah-Hartman
2015-04-22 14:05                   ` Austin S Hemmelgarn
2015-04-22 13:27                 ` Havoc Pennington
2015-04-22 14:35                   ` Michele Curti
2015-04-22 20:02                     ` Havoc Pennington
2015-04-22 21:48                       ` Linus Torvalds
2015-04-23  5:35                         ` Havoc Pennington
2015-04-24 14:32                         ` Olaf Hering
2015-04-24 14:39                           ` Michele Curti
2015-04-24 15:02                             ` Olaf Hering
2015-04-24 15:14                               ` Michele Curti
2015-04-24 14:41                           ` Jiri Kosina
2015-04-24 15:04                             ` Olaf Hering
2015-04-24 17:52                           ` Linus Torvalds
2015-04-24 18:00                             ` Linus Torvalds
2015-04-23  8:38                       ` Michele Curti
2015-04-22 10:45           ` One Thousand Gnomes
2015-04-22 11:41           ` David Herrmann
2015-04-22  8:58   ` [GIT PULL] kdbus for 4.1-rc1 Borislav Petkov
2015-04-23 19:14     ` Greg Kroah-Hartman
2015-04-23 20:56       ` Borislav Petkov
2015-04-23 21:22         ` David Herrmann
2015-04-23 21:33           ` Richard Weinberger
2015-04-24 14:02             ` Steven Rostedt
2015-04-23 21:41           ` Borislav Petkov
2015-04-24  5:02             ` Steven Noonan
2015-04-24  9:04               ` Borislav Petkov
2015-04-24 10:28                 ` Daniel Mack
2015-04-24 10:50                   ` Borislav Petkov
2015-04-24 11:26                     ` Daniel Mack
2015-04-24  6:36         ` Greg Kroah-Hartman
2015-04-24  6:45           ` Greg Kroah-Hartman
2015-04-24  7:27             ` Martin Steigerwald
2015-04-24  8:35             ` Greg Kroah-Hartman
2015-04-13 20:13 ` Andy Lutomirski
2015-04-13 20:45   ` Greg Kroah-Hartman
2015-04-13 21:01     ` Andy Lutomirski
2015-04-14 17:50       ` Greg Kroah-Hartman
2015-04-14 18:57         ` Andy Lutomirski
2015-04-14 19:23           ` Greg Kroah-Hartman
2015-04-14 19:24             ` Borislav Petkov
2015-04-14 19:32               ` Greg Kroah-Hartman
2015-04-14 19:40                 ` Al Viro
2015-04-14 19:48                   ` Greg Kroah-Hartman
2015-04-14 19:53                     ` Borislav Petkov
2015-04-15  8:44                       ` Greg Kroah-Hartman
2015-04-15  8:54                         ` Jiri Kosina
2015-04-15  9:09                           ` Greg Kroah-Hartman
2015-04-15 12:36                             ` Al Viro
2015-04-15 13:13                               ` Greg Kroah-Hartman
2015-04-15 16:47                             ` Steven Rostedt
2015-04-15  9:35                         ` Borislav Petkov
2015-04-15 11:45                           ` Greg Kroah-Hartman
2015-04-14 20:11                     ` Martin Steigerwald
2015-04-14 22:39                     ` Jiri Kosina
2015-04-15  8:38                       ` Greg Kroah-Hartman
2015-04-15 10:37                       ` One Thousand Gnomes
2015-04-15 11:49                         ` Greg Kroah-Hartman
2015-04-15 12:03                           ` One Thousand Gnomes
2015-04-15 12:41                             ` Greg Kroah-Hartman
2015-04-15 14:06                               ` One Thousand Gnomes
2015-04-15 16:27                                 ` Havoc Pennington
2015-04-15 12:55                           ` Al Viro
2015-04-15 17:33                           ` Steven Rostedt
2015-04-15 18:11                             ` Greg Kroah-Hartman
2015-04-14 19:35             ` Al Viro
2015-04-14 19:43               ` Greg Kroah-Hartman
2015-04-15 17:59                 ` Austin S Hemmelgarn
2015-04-15 18:04                   ` Rik van Riel
2015-04-15 22:22                   ` One Thousand Gnomes
2015-04-16 16:02                     ` Havoc Pennington
2015-04-16 17:31                       ` David Herrmann
2015-04-16 20:55                         ` Al Viro
2015-04-18 11:44                           ` David Herrmann
2015-04-16 16:37                     ` Robert Schwebel
2015-04-17 13:45                       ` Greg Kroah-Hartman
2015-04-21 16:54                   ` Diego Viola
2015-04-21 17:06                     ` Greg Kroah-Hartman
2015-04-21 17:25                       ` Diego Viola
2015-04-14 20:14             ` John Stoffel
2015-04-14 21:51               ` Steven Rostedt
2015-04-14 22:05                 ` Jiri Kosina
2015-04-15  6:56                   ` Borislav Petkov
2015-04-15  8:37                   ` Greg Kroah-Hartman
2015-04-15 18:12                     ` James Bottomley
2015-04-16 12:13                       ` David Herrmann
2015-04-17 19:27                         ` James Bottomley
2015-04-17 20:27                           ` Havoc Pennington
2015-04-17 21:45                             ` Alex Elsayed
2015-04-20 18:01                             ` James Bottomley
2015-04-21  8:09                               ` Daniel Mack
2015-04-21 18:25                                 ` Andy Lutomirski
2015-04-15  8:35               ` Greg Kroah-Hartman
2015-04-15 12:00           ` Greg Kroah-Hartman
2015-04-15 12:09             ` Jiri Kosina
2015-04-15 12:18               ` One Thousand Gnomes
2015-04-15 12:30                 ` Greg Kroah-Hartman
2015-04-15 12:27               ` Greg Kroah-Hartman
2015-04-14 22:33         ` Jiri Kosina
2015-04-15  8:56           ` Greg Kroah-Hartman
2015-04-15 11:06             ` One Thousand Gnomes
2015-04-15 16:00               ` Rik van Riel
2015-04-15 16:44                 ` Havoc Pennington
2015-04-15 18:16                   ` Steven Rostedt
2015-04-15 18:40                     ` Havoc Pennington
2015-04-15 20:22                   ` Andy Lutomirski
2015-04-15 20:41                     ` Al Viro
2015-04-15 21:07                     ` Rik van Riel
2015-04-16 18:03                       ` Djalal Harouni
2015-04-15 21:58                     ` Havoc Pennington
2015-04-16 13:13                     ` Tom Gundersen
2015-04-16 14:34                       ` Andy Lutomirski
2015-04-16 15:01                         ` David Herrmann
2015-04-16 17:04                           ` Andy Lutomirski
2015-04-17  9:19                             ` Michal Hocko
2015-04-17 18:54                               ` Andy Lutomirski
2015-04-20 12:43                                 ` Michal Hocko
2015-04-20 20:03                                   ` Andy Lutomirski
2015-04-16 19:01                       ` Havoc Pennington
2015-04-17 13:23                         ` Daniel Mack
2015-04-17 14:54                           ` Havoc Pennington
2015-04-15 22:08                   ` One Thousand Gnomes
2015-04-16 13:14                     ` Daniel Mack
2015-04-16 17:15                       ` One Thousand Gnomes
2015-04-23 13:05 ` Greg Kroah-Hartman
2015-04-23 13:06   ` [PATCH] kdbus: pool: use __vfs_read() Greg Kroah-Hartman
2015-04-23 14:17   ` [GIT PULL] kdbus for 4.1-rc1 One Thousand Gnomes
2015-04-23 16:36   ` Greg Kroah-Hartman
2015-04-23 16:46     ` Andy Lutomirski
2015-04-23 17:16       ` Greg Kroah-Hartman
2015-04-23 17:34         ` Andy Lutomirski
2015-04-23 17:42         ` Stephen Smalley
2015-04-23 19:30           ` Greg Kroah-Hartman
2015-04-24  2:08             ` Karol Lewandowski
2015-04-29 21:16               ` Paul Moore
2015-04-23 17:57         ` Linus Torvalds
2015-04-23 18:04           ` Linus Torvalds
2015-04-23 18:56             ` Greg Kroah-Hartman
2015-04-23 19:22               ` Andy Lutomirski
2015-04-23 19:33                 ` Greg KH
2015-04-23 20:53                   ` Linus Torvalds
2015-04-23 20:51               ` Linus Torvalds
2015-04-23 18:48           ` Linus Torvalds
2015-04-24 13:50         ` Lukasz Skalski
2015-04-24 14:19           ` Havoc Pennington
2015-04-24 14:34             ` Lukasz Skalski
2015-04-24 19:25               ` Greg Kroah-Hartman
2015-04-27  8:57                 ` Lukasz Skalski
2015-04-27 17:18                   ` Greg Kroah-Hartman
2015-04-27 22:29                   ` David Lang
2015-04-28 10:53                     ` Lukasz Skalski
2015-04-27 21:32           ` Linus Torvalds
2015-04-27 21:40             ` Andy Lutomirski
2015-04-27 22:00               ` Linus Torvalds
2015-04-27 22:14                 ` Linus Torvalds
2015-04-28 13:44                   ` Havoc Pennington
2015-04-28 14:48                     ` Havoc Pennington
2015-04-28 17:18                       ` Theodore Ts'o
2015-04-28 20:25                         ` Havoc Pennington
2015-04-28 23:12                           ` John Stoffel
2015-04-29  0:45                             ` Havoc Pennington
2015-04-29 11:33                             ` Harald Hoyer
2015-04-29 12:47                             ` Harald Hoyer
2015-04-29 13:33                               ` Richard Weinberger
2015-04-29 13:38                                 ` Harald Hoyer
2015-04-29 13:46                                   ` Richard Weinberger
2015-04-29 14:01                                     ` Harald Hoyer
2015-04-29 14:04                                       ` Richard Weinberger
2015-04-29 14:11                                         ` Harald Hoyer
2015-04-29 14:18                                           ` Richard Weinberger
2015-04-29 14:53                                             ` Harald Hoyer
2015-04-29 14:58                                               ` Richard Weinberger
2015-04-29 15:03                                               ` Theodore Ts'o
2015-04-29 15:21                                                 ` Austin S Hemmelgarn
2015-04-30  9:05                                                   ` Łukasz Stelmach
2015-04-30  9:12                                                     ` Richard Weinberger
2015-04-30 10:19                                                       ` Łukasz Stelmach
2015-04-30 10:40                                                         ` Richard Weinberger
2015-04-30 12:16                                                           ` Łukasz Stelmach
2015-04-30 12:23                                                             ` Richard Weinberger
2015-04-30 12:40                                                               ` Łukasz Stelmach
2015-04-30 12:45                                                                 ` Richard Weinberger
2015-04-30 14:52                                                                   ` Łukasz Stelmach
2015-04-30 15:05                                                                     ` Richard Weinberger
2015-07-03  9:13                                                                     ` cee1
2015-04-29 16:25                                                 ` Martin Steigerwald
2015-04-29 14:46                                           ` Austin S Hemmelgarn
2015-04-29 14:51                                             ` Richard Weinberger
2015-04-29 15:07                                             ` Harald Hoyer
2015-04-29 15:17                                               ` Austin S Hemmelgarn
2015-04-29 15:22                                                 ` Harald Hoyer
2015-04-29 15:41                                                   ` Austin S Hemmelgarn
2015-04-29 18:28                                                   ` Martin Steigerwald
2015-04-29 16:26                                   ` John Stoffel
2015-04-29 17:39                                     ` Steven Rostedt
2015-04-29 19:10                                       ` Martin Steigerwald
2015-04-29 19:28                                       ` John Stoffel
2015-04-29 22:49                                     ` Theodore Ts'o
2015-04-30  0:05                                       ` David Lang
2015-04-30  0:15                                         ` Dave Airlie
2015-04-30  0:18                                           ` David Lang
2015-04-30  1:20                                             ` Dave Airlie
2015-04-29 13:35                               ` Stephen Smalley
2015-04-29 15:18                                 ` Simon McVittie
2015-04-29 17:48                                   ` Stephen Smalley
2015-04-29 15:27                               ` Martin Steigerwald
2015-04-29 16:36                                 ` David Lang
2015-04-29 18:54                               ` Andy Lutomirski
2015-04-29 19:30                                 ` Austin S Hemmelgarn
2015-04-29 19:42                                   ` Andy Lutomirski
2015-04-29 20:15                                     ` David Lang
2015-04-29 20:24                                       ` Andy Lutomirski
2015-04-29 20:43                                         ` David Lang
2015-04-29 20:51                                           ` David Herrmann
2015-04-30  1:42                                             ` John Stoffel
2015-04-29 22:34                                   ` John Stoffel
2015-04-30 20:14                               ` Eric W. Biederman
2015-05-01 15:49                               ` Austin S Hemmelgarn
2015-04-28 17:19                       ` David Lang
2015-04-28 19:19                         ` Havoc Pennington
2015-04-28 20:34                           ` David Lang
2015-04-28 20:42                             ` Andy Lutomirski
2015-04-28 20:43                           ` Linus Torvalds
2015-06-22 17:33                   ` Jindrich Makovicka
2015-06-22 20:23                     ` Jiri Kosina
2015-06-22 21:24                   ` Jindřich Makovička
2015-07-07 21:40                   ` Johannes Stezenbach
2015-04-28 12:49                 ` Havoc Pennington
2015-04-28 10:39             ` Lukasz Skalski
2015-04-23 18:33   ` Richard Weinberger
2015-04-23 19:01     ` Greg Kroah-Hartman
2015-04-23 18:57   ` Kdbus needs meaningful review (was: Re: [GIT PULL] kdbus for 4.1-rc1) Eric W. Biederman

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=87oamhmbso.fsf_-_@x220.int.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=daniel@zonque.org \
    --cc=dh.herrmann@gmail.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=teg@jklm.no \
    --cc=tixxdz@opendz.org \
    --cc=torvalds@linux-foundation.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

Powered by JetHome