From: Greg Kurz <groug@kaod.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: P J P <ppandit@redhat.com>,
Qemu Developers <qemu-devel@nongnu.org>,
Prasad J Pandit <pjp@fedoraproject.org>,
"Michael S. Tsirkin" <mtsirkin@redhat.com>,
Felix Wilhelm <fwilhelm@ernw.de>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH] 9pfs: add check for relative path
Date: Fri, 19 Aug 2016 18:37:17 +0200 [thread overview]
Message-ID: <20160819183717.4de8c99d@bahia.lan> (raw)
In-Reply-To: <CAFEAcA8dqyBLJmCGJLWQupHqWPzuL51Yz7YG+CspjMokpqOoOQ@mail.gmail.com>
On Fri, 19 Aug 2016 16:14:48 +0100
Peter Maydell <peter.maydell@linaro.org> wrote:
> On 19 August 2016 at 15:55, Peter Maydell <peter.maydell@linaro.org> wrote:
> > Also, strstr(name, "../") is the wrong check. There are I think
> > two possibilities here:
> >
> > (1) the "name" parameter may only validly be a single pathname
> > component. In this case we should be enforcing this by treating
> > any string with a "/" in it as an error (and checking for "../"
> > is not catching all the cases that should be errors).
> >
> > (2) the "name" parameter may be a multiple-pathname-component value.
> > In this case "../" catches too many cases, because "foo../bar" is
> > a valid string which is not relative. You would need to check for
> > (contains "/../" OR starts with "../" OR ends with "/.." OR is "..").
> >
> >
> > On IRC Greg and I discussed this and Greg suggested that
> > case (1) is what we have. We should check this though.
>
> If (1) is true and "only single path component" is a protocol
> requirement then probably we should be enforcing this at a
> higher layer than in 9p-local.c, ie in hw/9pfs/cofs.c.
>
As we discussed on IRC, the / character isn't invalid per-se. It raises
issues with the local backend on a linux host but does not do harm with
other backends.
The proxy backend also accesses the linux filesystem but since it
chroots to the export path, it does not hit the path traversal issue.
Aneesh suggested an alternative to doing checks on the names would be
to forbid access outside the export path but I can't think of a simple
way to do that.
> thanks
> -- PMM
Cheers.
--
Greg
next prev parent reply other threads:[~2016-08-19 16:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 5:13 [Qemu-devel] [PATCH] 9pfs: add check for relative path P J P
2016-08-11 6:17 ` no-reply
2016-08-11 6:27 ` Fam Zheng
2016-08-18 16:55 ` Greg Kurz
2016-08-11 6:31 ` Aneesh Kumar K.V
2016-08-18 15:19 ` Greg Kurz
2016-08-18 17:06 ` Greg Kurz
2016-08-19 14:55 ` Peter Maydell
2016-08-19 15:14 ` Peter Maydell
2016-08-19 16:37 ` Greg Kurz [this message]
2016-08-19 17:03 ` Peter Maydell
2016-08-19 17:30 ` Greg Kurz
2016-08-22 9:23 ` Peter Maydell
2016-08-22 10:07 ` P J P
2016-08-22 15:02 ` Michael S. Tsirkin
2016-08-22 15:07 ` Peter Maydell
2016-08-22 14:14 ` Michael S. Tsirkin
2016-08-19 16:24 ` Greg Kurz
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=20160819183717.4de8c99d@bahia.lan \
--to=groug@kaod.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=fwilhelm@ernw.de \
--cc=mtsirkin@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pjp@fedoraproject.org \
--cc=ppandit@redhat.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).