From: Stefan Hajnoczi <stefanha@gmail.com>
To: Anthony Liguori <aliguori@linux.vnet.ibm.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Christoph Hellwig <hch@lst.de>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Make default invocation of block drivers safer
Date: Thu, 15 Jul 2010 14:20:06 +0100 [thread overview]
Message-ID: <AANLkTilLY4KlQSFXj4IH9bEUYCx0GdfVi_hYdQ3FlS9c@mail.gmail.com> (raw)
In-Reply-To: <4C3F05AA.3050106@linux.vnet.ibm.com>
On Thu, Jul 15, 2010 at 1:57 PM, Anthony Liguori
<aliguori@linux.vnet.ibm.com> wrote:
> On 07/15/2010 04:10 AM, Stefan Hajnoczi wrote:
>>
>> I have mixed feelings about this approach. It has good usability
>> because legitimate users are unaffected, but adding a check into the
>> I/O path is unfortunate from a clean code perspective.
>>
>> Management stacks that don't explicitly set format= today are in
>> trouble. In an environment where the VM owner is untrusted, the VM
>> owner could provide/upload a malicious disk image and cold boot it.
>>
>
> More specifically, management stacks are in trouble if they use raw images
> and don't use format=. Anyone using qcow2 exclusively is fine.
>
> I'm less concerned about uploaded images. Format spoofing is really the
> least of the concerns for uploaded images. The bigger concern IMHO is
> attempting to exploit vulnerabilities in qcow2 or any of the other image
> formats.
Attempting to exploit vulnerabilities in image formats is exactly what
you can do with image spoofing, even though your VM was created with a
raw image.
>
>> This patch only prevents dodgy images created inside a running VM.
>> Luckily this scenario is increasingly unlikely since management stacks
>> specifying explicit format= and SELinux/sVirt will eventually make
>> this go away.
>>
>> I think there are actually two issues here:
>>
>> 1. Confusing QEMU so it sees an image with a different format than
>> expected.
>>
>> This is important because it's unexpected behavior for a user who puts
>> a QCOW2 image onto a raw disk to find the disk itself turn into a
>> QCOW2 disk on next reboot.
>>
>> I also worry about this bug because it means that in a scenario where
>> format= is not explicitly given, the VM can change its disk image
>> format. This is a problem because the host administrator might have
>> used raw files and be unhappy to find that the user is able to exploit
>> a (hypothetical) security issue in the vmdk code despite having
>> created the VM with a raw image.
>>
>
> One of the nasty things in QEMU right now is that we have absolutely no way
> to persist information about the guest and we have no persistent definition
> of the guest.
>
> All of our VMs are basically stateless across invocations and that really
> makes things like this difficult.
>
>> 2. Image formats that support backing files are inherently insecure.
>>
>> The final scenario that doesn't go away is the casual user who tries
>> out a foreign disk image. The expectation is that the disk image
>> could boot up and do completely silly things but it could not affect
>> the host. In reality it can read the contents of any file owned by
>> the uid running QEMU and send them over the internet if the guest has
>> networking.
>>
>> You really need to run qemu-img info to check that there is no
>> unwanted backing file. So I suspect we'll never be 100% safe unless
>> backing files are disabled by default with an error message asking you
>> to add allow_backing_file=on.
>>
>
> I'm not sure I'd classify it as insecure. They are only insecure *if* the
> guest can modify the backing file. With the proposed patch, they can't.
You cannot trust a QCOW2 file I give you, it might read your mailbox
and send me the contents. This is the offline attack vector again,
not a running VM modifying its disk image and rebooting.
I think it is reasonable to expect a published disk image to be unable
to access local files on the host.
Stefan
prev parent reply other threads:[~2010-07-15 13:20 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-14 16:12 [Qemu-devel] [PATCH] Make default invocation of block drivers safer Anthony Liguori
2010-07-14 16:42 ` [Qemu-devel] " Kevin Wolf
2010-07-14 17:40 ` Anthony Liguori
2010-07-15 8:00 ` Kevin Wolf
2010-07-14 18:43 ` [Qemu-devel] " Christoph Hellwig
2010-07-14 18:50 ` Anthony Liguori
2010-07-15 9:20 ` Daniel P. Berrange
2010-07-15 12:35 ` Anthony Liguori
2010-07-15 15:19 ` Markus Armbruster
2010-07-15 16:20 ` Anthony Liguori
2010-07-15 17:10 ` Kevin Wolf
2010-07-15 17:51 ` Anthony Liguori
2010-07-16 7:30 ` Kevin Wolf
2010-07-16 12:55 ` Stefan Hajnoczi
2010-07-16 13:00 ` Stefan Hajnoczi
2010-07-16 16:06 ` Markus Armbruster
2010-07-16 16:16 ` Anthony Liguori
2010-07-16 16:24 ` Kevin Wolf
2010-07-14 18:53 ` Anthony Liguori
2010-07-14 18:54 ` Aurelien Jarno
2010-07-14 19:04 ` Anthony Liguori
2010-07-15 8:09 ` Kevin Wolf
2010-07-15 9:10 ` Stefan Hajnoczi
2010-07-15 12:57 ` Anthony Liguori
2010-07-15 13:16 ` Kevin Wolf
2010-07-15 13:20 ` Stefan Hajnoczi [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=AANLkTilLY4KlQSFXj4IH9bEUYCx0GdfVi_hYdQ3FlS9c@mail.gmail.com \
--to=stefanha@gmail.com \
--cc=aliguori@linux.vnet.ibm.com \
--cc=hch@lst.de \
--cc=kwolf@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).