Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1653469

Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI ioctl require CAP_SYS_ADMIN

From Stephen Smalley <sds@tycho.nsa.gov>
Newsgroups linux.kernel
Subject Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI ioctl require CAP_SYS_ADMIN
Date 2017-05-30 20:30 +0200
Message-ID <tMU41-2mV-7@gated-at.bofh.it> (permalink)
References (5 earlier) <tMELE-zH-7@gated-at.bofh.it> <tMFol-XX-3@gated-at.bofh.it> <tMFRn-1q5-5@gated-at.bofh.it> <tMOrE-7i1-25@gated-at.bofh.it> <tMSbU-1dJ-19@gated-at.bofh.it>
Organization National Security Agency

Show all headers | View raw


On Tue, 2017-05-30 at 12:28 -0400, Matt Brown wrote:
> On 5/30/17 8:24 AM, Alan Cox wrote:
> > Look there are two problems here
> > 
> > 1. TIOCSTI has users
> 
> I don't see how this is a problem.
> 
> > 
> > 2. You don't actually fix anything
> > 
> > The underlying problem is that if you give your tty handle to
> > another
> > process which you don't trust you are screwed. It's fundamental to
> > the
> > design of the Unix tty model and it's made worse in Linux by the
> > fact
> > that we use the tty descriptor to access all sorts of other console
> > state
> > (which makes a ton of sense).
> > 
> > Many years ago a few people got this wrong. All those apps got
> > fixes back
> > then. They allocate a tty/pty pair and create a new session over
> > that.
> > The potentially hostile other app only gets to screw itself.
> > 
> 
> Many years ago? We already got one in 2017, as well as a bunch last
> year.
> See: https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=tiocsti
> 
> > If it was only about TIOCSTI then your patch would still not make
> > sense
> > because you could use on of the existing LSMs to actually write
> > yourself
> > some rules about who can and can't use TIOCSTI. For that matter you
> > can
> > even use the seccomp feature today to do this without touching your
> > kernel because the ioctl number is a value so you can just block
> > ioctl
> > with argument 2 of TIOCSTI.
> > 
> 
> Seccomp requires the program in question to "opt-in" so to speak and
> set
> certain restrictions on itself. However as you state above, any
> TIOCSTI
> protection doesn't matter if the program correctly allocates a
> tty/pty pair.
> This protections seeks to protect users from programs that don't do
> things
> correctly. Rather than killing bugs, this feature attempts to kill an
> entire
> bug class that shows little sign of slowing down in the world of
> containers and
> sandboxes.

Just FYI, you can also restrict TIOCSTI (or any other ioctl command)
via SELinux ioctl whitelisting, and Android is using that feature to
restrict TIOCSTI usage in Android O (at least based on the developer
previews to date, also in AOSP master).

> 
> > So please explain why we need an obscure kernel config option that
> > normal
> > users will not understand which protects against nothing and can be
> > done already ?
> > 
> > Alan
> > 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-
> security-module" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v7 2/2] security: tty: make TIOCSTI ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-05-29 23:40 +0200
  Re: [PATCH v7 2/2] security: tty: make TIOCSTI ioctl require  CAP_SYS_ADMIN Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-05-30 00:30 +0200
    Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Boris Lukashev <blukashev@sempervictus.com> - 2017-05-30 02:00 +0200
      Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Casey Schaufler <casey@schaufler-ca.com> - 2017-05-30 02:30 +0200
        Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-05-30 04:10 +0200
          Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Casey Schaufler <casey@schaufler-ca.com> - 2017-05-30 04:50 +0200
            Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-05-30 05:20 +0200
              Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-05-30 14:30 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-05-30 18:30 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Daniel Micay <danielmicay@gmail.com> - 2017-05-30 18:50 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN Stephen Smalley <sds@tycho.nsa.gov> - 2017-05-30 20:30 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Nick Kralevich <nnk@google.com> - 2017-05-30 20:50 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-05-30 21:00 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN Daniel Micay <danielmicay@gmail.com> - 2017-05-30 22:30 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-05-31 01:10 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN Daniel Micay <danielmicay@gmail.com> - 2017-05-31 01:50 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-05-31 02:00 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-05-31 01:00 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-05-31 01:20 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-05-31 02:00 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Kees Cook <keescook@chromium.org> - 2017-06-01 04:40 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-06-01 15:10 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN "Serge E. Hallyn" <serge@hallyn.com> - 2017-06-01 19:20 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-06-01 23:30 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Kees Cook <keescook@chromium.org> - 2017-06-01 21:00 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-06-01 23:30 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-06-02 16:50 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN "Serge E. Hallyn" <serge@hallyn.com> - 2017-06-02 17:40 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-06-02 18:10 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN "Serge E. Hallyn" <serge@hallyn.com> - 2017-06-02 19:00 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-06-02 19:40 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN "Serge E. Hallyn" <serge@hallyn.com> - 2017-06-02 20:20 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-06-02 21:30 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Kees Cook <keescook@chromium.org> - 2017-06-02 21:30 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-06-02 21:30 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-06-02 22:10 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Nick Kralevich <nnk@google.com> - 2017-06-02 22:20 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-06-02 22:50 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make  TIOCSTI ioctl require CAP_SYS_ADMIN Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-06-04 00:10 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-06-04 00:30 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Peter Dolding <oiaohm@gmail.com> - 2017-06-04 05:40 +0200
              Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Casey Schaufler <casey@schaufler-ca.com> - 2017-05-30 17:30 +0200
                Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-05-30 18:10 +0200
        Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Boris Lukashev <blukashev@sempervictus.com> - 2017-06-04 08:30 +0200
      Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN James Morris <jmorris@namei.org> - 2017-05-31 04:50 +0200
        Re: [kernel-hardening] Re: [PATCH v7 2/2] security: tty: make TIOCSTI  ioctl require CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-05-31 06:20 +0200
    Re: [PATCH v7 2/2] security: tty: make TIOCSTI ioctl require  CAP_SYS_ADMIN Matt Brown <matt@nmatt.com> - 2017-05-30 02:20 +0200

csiph-web