All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Niki Denev" <ndenev@gmail.com>
To: "Bastian Blank" <bastian@waldi.eu.org>,
	"Willy Tarreau" <w@1wt.eu>,
	linux-kernel@vger.kernel.org, jens.axboe@oracle.com
Subject: Re: [PATCH] kernel 2.6.24.1 still vulnerable to the vmsplice local root exploit
Date: Sun, 10 Feb 2008 12:39:05 +0000	[thread overview]
Message-ID: <2e77fc10802100439u18e89008j9181f3b445daa231@mail.gmail.com> (raw)
In-Reply-To: <20080210122250.GA24048@wavehammer.waldi.eu.org>

On Feb 10, 2008 12:22 PM, Bastian Blank <bastian@waldi.eu.org> wrote:
> On Sun, Feb 10, 2008 at 04:40:53AM -0500, Niki Denev wrote:
> > this fixed the problem for me (kernel 2.6.24.1) :
> > It appears that the initial patch checked the input to vmsplice_to_user,
> > but the exploit used vmsplice_to_pipe which remained open to the attack.
>
> This patch is broken. It opens the old hole again.
>
> > @@ -1450,6 +1454,31 @@
> >               .ops = &user_page_pipe_buf_ops,
> >       };
> >
> > +     error = ret = 0;
> > +
> > +     /*
> > +      * Get user address base and length for this iovec.
> > +      */
> > +     error = get_user(base, &iov->iov_base);
> > +     if (unlikely(error))
> > +             return error;
> > +     error = get_user(len, &iov->iov_len);
> > +     if (unlikely(error))
> > +             return error;
>
> iov is unchecked.
>
> > +     if (unlikely(!access_ok(VERIFY_WRITE, base, len))) {
> > +             return -EFAULT;
> > +     }
>
> Use VERIFY_READ and this only checks the first entry.
>
> I checked the following patch and it at least fixes the known exploit.
>
> diff --git a/fs/splice.c b/fs/splice.c
> index 14e2262..80beb2b 100644
> --- a/fs/splice.c
> +++ b/fs/splice.c
> @@ -1237,6 +1237,11 @@ static int get_iovec_page_array(const struct iovec __user *iov,
>                 if (unlikely(!base))
>                         break;
>
> +               if (!access_ok(VERIFY_READ, base, len)) {
> +                       error = -EFAULT;
> +                       break;
> +               }
> +
>                 /*
>                  * Get this base offset and number of pages, then map
>                  * in the user pages.
> --
> Even historians fail to learn from history -- they repeat the same mistakes.
>                 -- John Gill, "Patterns of Force", stardate 2534.7
>

This patch is against 2.6.24.1 which has already the fix to vmsplice_to_user
With it i can't exploit the hole, and it is returns "invalid address"

  reply	other threads:[~2008-02-10 12:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-10  6:04 kernel 2.6.24.1 still vulnerable to the vmsplice local root exploit Niki Denev
2008-02-10  6:32 ` Willy Tarreau
2008-02-10  6:38   ` Niki Denev
2008-02-10  9:40     ` [PATCH] " Niki Denev
2008-02-10 12:04       ` Oliver Pinter
2008-02-10 12:22       ` Bastian Blank
2008-02-10 12:39         ` Niki Denev [this message]
2008-02-10 12:47           ` Bastian Blank
2008-02-10 12:54             ` Niki Denev
2008-02-10 13:02             ` Oliver Pinter
2008-02-10 17:05               ` [stable] " Greg KH
2008-02-10 17:11                 ` Pekka Enberg
2008-02-10 17:44                 ` Oliver Pinter
2008-02-10 17:48                 ` Oliver Pinter
2008-02-10 13:48         ` Niki Denev

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=2e77fc10802100439u18e89008j9181f3b445daa231@mail.gmail.com \
    --to=ndenev@gmail.com \
    --cc=bastian@waldi.eu.org \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=w@1wt.eu \
    /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.