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


Groups > linux.kernel > #1624577

Re: [PATCH 3/4] restrict unprivileged TIOCSTI tty ioctl

From Greg KH <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH 3/4] restrict unprivileged TIOCSTI tty ioctl
Date 2017-04-17 09:00 +0200
Message-ID <tx8NI-5UK-11@gated-at.bofh.it> (permalink)
References <tx81j-5DY-7@gated-at.bofh.it> <tx81l-5DY-47@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Apr 17, 2017 at 02:07:05AM -0400, Matt Brown wrote:
> this patch depends on patch 1 and 2
> 
> enforces restrictions on unprivileged users injecting commands
> into other processes in the same tty session using the TIOCSTI ioctl
> 
> Signed-off-by: Matt Brown <matt@nmatt.com>
> ---
>  drivers/tty/tty_io.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
> index e6d1a65..31894e8 100644
> --- a/drivers/tty/tty_io.c
> +++ b/drivers/tty/tty_io.c
> @@ -2296,11 +2296,15 @@ static int tty_fasync(int fd, struct file *filp, int on)
>   *	FIXME: may race normal receive processing
>   */
>  
> +int tiocsti_restrict = IS_ENABLED(CONFIG_SECURITY_TIOCSTI_RESTRICT);
> +
>  static int tiocsti(struct tty_struct *tty, char __user *p)
>  {
>  	char ch, mbz = 0;
>  	struct tty_ldisc *ld;
>  
> +	if (tiocsti_restrict && !capable(CAP_SYS_ADMIN))
> +		return -EPERM;

So, what type of "normal" userspace operations did you just break here?
What type of "not normal" did you break/change?

Why tie this to CAP_SYS_ADMIN as well?  That wasn't listed in your
Kconfig help text.  This seems like an additional capabilities
dependancy that odds are, most people do not want...

>  	if ((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN))
>  		return -EPERM;

And finally, why doesn't this original check handle what you want to do
already?

I don't understand your "threat model" you wish to address by this
change series, please be a lot more explicit in your patch changelog
descriptions.

thanks,

greg k-h

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


Thread

Patchset to Restrict Unprivileged TIOCSTI TTY Command Injection Matt Brown <matt@nmatt.com> - 2017-04-17 08:10 +0200
  [PATCH 3/4] restrict unprivileged TIOCSTI tty ioctl Matt Brown <matt@nmatt.com> - 2017-04-17 08:10 +0200
    Re: [PATCH 3/4] restrict unprivileged TIOCSTI tty ioctl Greg KH <gregkh@linuxfoundation.org> - 2017-04-17 09:00 +0200
      Re: [kernel-hardening] Re: [PATCH 3/4] restrict unprivileged TIOCSTI  tty ioctl Jann Horn <jannh@google.com> - 2017-04-17 16:20 +0200
        Re: [kernel-hardening] Re: [PATCH 3/4] restrict unprivileged TIOCSTI  tty ioctl Matt Brown <matt@nmatt.com> - 2017-04-17 18:30 +0200

csiph-web