All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: James Morris <jmorris@namei.org>
Cc: lazytyped <lazytyped@gmail.com>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>
Subject: Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI ioctl require CAP_SYS_ADMIN
Date: Fri, 2 Jun 2017 11:46:22 -0700	[thread overview]
Message-ID: <CAGXu5jJUYh_+kyfwyaJMUjyNSC+p=xbgGkirOqu89TVRY_bYSg@mail.gmail.com> (raw)
In-Reply-To: <alpine.LRH.2.20.1706020830520.16910@namei.org>

On Thu, Jun 1, 2017 at 3:56 PM, James Morris <jmorris@namei.org> wrote:
> On Thu, 1 Jun 2017, Kees Cook wrote:
>
>> All of the reasoning here seems to match the link restrictions from 5
>> years ago: a crappy API (sticky bit) is not handled by userspace (open
>> /tmp/$$!) and people get attacked. The solution was a sysctl to enable
>> the link restrictions that killed the entire class of the common
>> attack (though it didn't solve especially egregious bad uses, much
>
> This is the problem -- it doesn't really eliminate the underlying issue.
>
> A better solution (in this case) was to implement a new API which
> addresses the issue at an architectural level, i.e. namespace-based
> private /tmp views, and encourage its adoption.

I think this is a frequent mistake in evaluating how to kill bug
classes: there doesn't have to be only one solution, especially when
there are downsides to be dealt with. In the link restriction case,
the VFS solution immediately solved the vast majority of issues
without breaking any applications. The private /tmp takes time to roll
out, and breaks the shared /tmp way of doing things that some tools
use to share files, etc. So the private /tmp solves more of the
problem (eliminates link attacks in subdirectories of /tmp), but
breaks real use-cases. And ultimately, there is nothing incompatible
about the solutions, so both could (and were) pursued.

>> like the TIOCSTI fix). Every distro enabled the sysctl, and, while the
>> data is noisy, looking a CVEs matching "/tmp symlink", the numbers
>> drop from 2013 and later (with none yet for 2017).
>
> I wonder how much of this is due to the sysctl vs. adoption of private
> /tmp, and what may be lurking in the "egregious bad uses" category for
> future CVEs.  And obviously we don't know what various folk may have up
> their sleeves, if anything.

Private /tmp is still somewhat less common, the VFS changes were
rolled out almost universally, so, if the numbers can be trusted at
all, I would assume it's the VFS changes. That said, CVE numbers tend
to fluctuate based on researcher interest, rather than being a true
measure of real-world problems. The anecdata I have while at Ubuntu
was having people complain about getting owned by /tmp symlink ToCToU
from time to time on the Ubuntu security IRC channel, and after Ubuntu
rolled out the VFS changes, that dropped to zero in all the years
since.

So, I guess, my point is that there are always multiple solutions that
come with various benefits and downsides, and when there isn't a
perfect solution, imperfect solutions that make real-world changes on
attack surface are worth pursuing, even in parallel. Perfection
shouldn't be the enemy of the good. (Perfection is preferred, but it's
not usuallyt pragmatically possible.)

-Kees

-- 
Kees Cook
Pixel Security

  reply	other threads:[~2017-06-02 18:46 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-29 21:37 [PATCH v7 0/2] security: tty: make TIOCSTI ioctl require CAP_SYS_ADMIN Matt Brown
2017-05-29 21:37 ` [kernel-hardening] " Matt Brown
2017-05-29 21:37 ` Matt Brown
2017-05-29 21:37 ` [PATCH v7 1/2] security: tty: Add owner user namespace to tty_struct Matt Brown
2017-05-29 21:37   ` [kernel-hardening] " Matt Brown
2017-05-29 21:37   ` Matt Brown
2017-05-29 21:38 ` [PATCH v7 2/2] security: tty: make TIOCSTI ioctl require CAP_SYS_ADMIN Matt Brown
2017-05-29 21:38   ` [kernel-hardening] " Matt Brown
2017-05-29 21:38   ` Matt Brown
2017-05-29 22:26   ` Alan Cox
2017-05-29 22:26     ` [kernel-hardening] " Alan Cox
2017-05-29 22:26     ` Alan Cox
2017-05-29 23:51     ` [kernel-hardening] " Boris Lukashev
2017-05-29 23:51       ` Boris Lukashev
2017-05-30  0:27       ` Casey Schaufler
2017-05-30  0:27         ` Casey Schaufler
2017-05-30  2:00         ` Matt Brown
2017-05-30  2:00           ` Matt Brown
2017-05-30  2:46           ` Casey Schaufler
2017-05-30  2:46             ` Casey Schaufler
2017-05-30  3:18             ` Matt Brown
2017-05-30  3:18               ` Matt Brown
2017-05-30 12:24               ` Alan Cox
2017-05-30 12:24                 ` Alan Cox
2017-05-30 16:28                 ` Matt Brown
2017-05-30 16:28                   ` Matt Brown
2017-05-30 16:44                   ` Daniel Micay
2017-05-30 16:44                     ` Daniel Micay
2017-05-30 18:32                   ` Stephen Smalley
2017-05-30 18:32                     ` Stephen Smalley
2017-05-30 18:44                     ` Nick Kralevich
2017-05-30 18:44                       ` Nick Kralevich
2017-05-30 18:57                       ` Matt Brown
2017-05-30 18:57                         ` Matt Brown
2017-05-30 20:22                         ` Daniel Micay
2017-05-30 20:22                           ` Daniel Micay
2017-05-30 23:00                           ` Matt Brown
2017-05-30 23:00                             ` Matt Brown
2017-05-30 23:40                             ` Daniel Micay
2017-05-30 23:40                               ` Daniel Micay
2017-05-30 23:59                               ` Matt Brown
2017-05-30 23:59                                 ` Matt Brown
2017-05-30 22:51                   ` Alan Cox
2017-05-30 22:51                     ` Alan Cox
2017-05-30 23:19                     ` Matt Brown
2017-05-30 23:19                       ` Matt Brown
2017-05-30 23:56                       ` Alan Cox
2017-05-30 23:56                         ` Alan Cox
2017-06-01  2:35                         ` Kees Cook
2017-06-01  2:35                           ` Kees Cook
2017-06-01  2:35                           ` Kees Cook
2017-06-01  7:12                           ` lazytyped
2017-06-01 18:46                             ` Kees Cook
2017-06-01 22:56                               ` James Morris
2017-06-02 18:46                                 ` Kees Cook [this message]
2017-06-01 13:08                           ` Alan Cox
2017-06-01 13:08                             ` Alan Cox
2017-06-01 13:08                             ` Alan Cox
2017-06-01 17:18                             ` Serge E. Hallyn
2017-06-01 17:18                               ` Serge E. Hallyn
2017-06-01 17:18                               ` Serge E. Hallyn
2017-06-01 21:26                               ` Alan Cox
2017-06-01 21:26                                 ` Alan Cox
2017-06-01 21:26                                 ` Alan Cox
2017-06-01 18:58                             ` Kees Cook
2017-06-01 18:58                               ` Kees Cook
2017-06-01 18:58                               ` Kees Cook
2017-06-01 21:24                               ` Alan Cox
2017-06-01 21:24                                 ` Alan Cox
2017-06-01 21:24                                 ` Alan Cox
2017-06-02 14:46                                 ` Matt Brown
2017-06-02 14:46                                   ` Matt Brown
2017-06-02 14:46                                   ` Matt Brown
2017-06-02 15:36                                   ` Serge E. Hallyn
2017-06-02 15:36                                     ` Serge E. Hallyn
2017-06-02 15:36                                     ` Serge E. Hallyn
2017-06-02 16:02                                     ` Matt Brown
2017-06-02 16:02                                       ` Matt Brown
2017-06-02 16:02                                       ` Matt Brown
2017-06-02 16:57                                       ` Serge E. Hallyn
2017-06-02 16:57                                         ` Serge E. Hallyn
2017-06-02 16:57                                         ` Serge E. Hallyn
2017-06-02 16:57                                         ` Serge E. Hallyn
2017-06-02 17:32                                         ` Matt Brown
2017-06-02 17:32                                           ` Matt Brown
2017-06-02 17:32                                           ` Matt Brown
2017-06-02 18:18                                           ` Serge E. Hallyn
2017-06-02 18:18                                             ` Serge E. Hallyn
2017-06-02 18:18                                             ` Serge E. Hallyn
2017-06-02 18:18                                             ` Serge E. Hallyn
2017-06-02 19:22                                             ` Matt Brown
2017-06-02 19:22                                               ` Matt Brown
2017-06-02 19:22                                               ` Matt Brown
2017-06-02 19:25                                               ` Kees Cook
2017-06-02 19:25                                                 ` Kees Cook
2017-06-02 19:25                                                 ` Kees Cook
2017-06-02 19:25                                                 ` Kees Cook
2017-06-02 19:26                                                 ` Matt Brown
2017-06-02 19:26                                                   ` Matt Brown
2017-06-02 19:26                                                   ` Matt Brown
2017-06-02 19:26                                                   ` Matt Brown
2017-06-02 20:05                                       ` Alan Cox
2017-06-02 20:05                                         ` Alan Cox
2017-06-02 20:05                                         ` Alan Cox
2017-06-02 20:11                                         ` Nick Kralevich
2017-06-02 20:11                                           ` Nick Kralevich
2017-06-02 20:11                                           ` Nick Kralevich
2017-06-02 20:46                                         ` Matt Brown
2017-06-02 20:46                                           ` Matt Brown
2017-06-02 20:46                                           ` Matt Brown
2017-06-03 22:00                                           ` Alan Cox
2017-06-03 22:00                                             ` Alan Cox
2017-06-03 22:00                                             ` Alan Cox
2017-06-03 22:22                                             ` Matt Brown
2017-06-03 22:22                                               ` Matt Brown
2017-06-03 22:22                                               ` Matt Brown
2017-06-04  3:37                                               ` Peter Dolding
2017-06-04  3:37                                                 ` Peter Dolding
2017-06-04  3:37                                                 ` Peter Dolding
2017-05-30 15:20               ` Casey Schaufler
2017-05-30 15:20                 ` Casey Schaufler
2017-05-30 16:09                 ` Matt Brown
2017-05-30 16:09                   ` Matt Brown
2017-06-04  6:29         ` Boris Lukashev
2017-06-04  6:29           ` Boris Lukashev
2017-05-31  2:48       ` James Morris
2017-05-31  2:48         ` James Morris
2017-05-31  4:10         ` Matt Brown
2017-05-31  4:10           ` Matt Brown
2017-05-30  0:15     ` Matt Brown
2017-05-30  0:15       ` [kernel-hardening] " Matt Brown
2017-05-30  0:15       ` Matt Brown

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='CAGXu5jJUYh_+kyfwyaJMUjyNSC+p=xbgGkirOqu89TVRY_bYSg@mail.gmail.com' \
    --to=keescook@chromium.org \
    --cc=jmorris@namei.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=lazytyped@gmail.com \
    /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.