From: Bandan Das <bsd@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH for-3.1 2/2] usb-mtp: outlaw slashes in filenames
Date: Fri, 30 Nov 2018 15:08:09 -0500 [thread overview]
Message-ID: <jpg1s7272hi.fsf@linux.bootlegged.copy> (raw)
In-Reply-To: <20181130111222.25386-3-kraxel@redhat.com> (Gerd Hoffmann's message of "Fri, 30 Nov 2018 12:12:22 +0100")
Gerd Hoffmann <kraxel@redhat.com> writes:
> Slash is unix directory separator, so they are not allowed in filenames.
> Note this also stops the classic escape via "../".
>
> Fixes: CVE-2018-16867
> Reported-by: Michael Hanselmann (hansmi.ch)
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> hw/usb/dev-mtp.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
> index fbe1ace035..87eeac1084 100644
> --- a/hw/usb/dev-mtp.c
> +++ b/hw/usb/dev-mtp.c
> @@ -1718,6 +1718,12 @@ static void usb_mtp_write_metadata(MTPState *s)
>
> filename = utf16_to_str(dataset->length, dataset->filename);
>
> + if (strchr(filename, '/')) {
> + usb_mtp_queue_result(s, RES_INVALID_PARAMETER, d->trans,
> + 0, 0, 0, 0);
> + return;
> + }
> +
> o = usb_mtp_object_lookup_name(p, filename, dataset->length);
> if (o != NULL) {
> next_handle = o->handle;
Should we return PARAMETER_NOT_SUPPORTED instead of INVALID_PARAMETER ?
That's a valid response code for SendObjectInfo acc to the spec.
Bandan
prev parent reply other threads:[~2018-11-30 20:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-30 11:12 [Qemu-devel] [PATCH for-3.1 0/2] usb-mtp: two bugfixes (one security fix) Gerd Hoffmann
2018-11-30 11:12 ` [Qemu-devel] [PATCH for-3.1 1/2] usb-mtp: fix utf16_to_str Gerd Hoffmann
2018-11-30 13:13 ` Markus Armbruster
2018-11-30 19:58 ` Bandan Das
2018-11-30 11:12 ` [Qemu-devel] [PATCH for-3.1 2/2] usb-mtp: outlaw slashes in filenames Gerd Hoffmann
2018-11-30 19:08 ` Philippe Mathieu-Daudé
2018-11-30 19:58 ` Eric Blake
2018-12-01 11:55 ` Philippe Mathieu-Daudé
2018-12-01 13:49 ` Michael Hanselmann
2018-11-30 20:08 ` Bandan Das [this message]
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=jpg1s7272hi.fsf@linux.bootlegged.copy \
--to=bsd@redhat.com \
--cc=kraxel@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).