qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Cody <jcody@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] Image probing: how it can be insecure, and what we could do about it
Date: Mon, 10 Nov 2014 09:24:49 -0500	[thread overview]
Message-ID: <20141110142449.GA3365@localhost.localdomain> (raw)
In-Reply-To: <87egtbuz3y.fsf@blackfin.pond.sub.org>

On Mon, Nov 10, 2014 at 11:30:25AM +0100, Markus Armbruster wrote:
> Kevin Wolf <kwolf@redhat.com> writes:
> 
> > Am 10.11.2014 um 09:12 hat Markus Armbruster geschrieben:
> >> Jeff Cody <jcody@redhat.com> writes:
> >> > So that would mean .img would always require format=, right?
> >> >
> >> > That also implies to me that the only extensions for raw that might
> >> > not require format= would be .iso and .raw.
> >> 
> >> .img means what we choose it to mean.
> >> 
> >> If we choose "can mean anything, including raw", then .img always
> >> requires an explicit format with this approach.
> >> 
> >> If we choose "means raw", then same as above, except you can omit
> >> format=raw, and you become prone to opening existing non-raw formats
> >> raw, which can be bad.
> >
> > My current thoughts about .img are that we need to consider that
> >
> > (a) it is occasionally used for multiple image formats and making it
> >     raw unconditionally is going to cause corruption.
> >
> > (b) looking at file extensions is absolutely useless if we exlucde
> >     .img from the automatic detection because it's still the main
> >     extension for raw.
> >
> > The common case could probably be covered by bringing probing back into
> > the game: If an .img file successfully probes for a non-raw format,
> > error out, avoiding the corruption. If it doesn't, assume raw.
> 
> I think this is the "refuse to use a format without an explicit format=
> when any other non-raw format probe accepts" idea, which should combine
> nicely with all the other ideas proposed so far.
> 
> Combining it with the hybrid approach we're discussing here gets us
> something like this, assuming .img means raw:
> 
> 1. Guess possible formats from trusted meta-data
> 
>    For foo.img, this yields { raw }.
> 
> 2. Probe to pick one
> 
>    Since { raw } has just one member, pick it without probing.
> 
> 3. Now probe all other non-raw formats, and error out if any accepts
> 
>    Protects users from opening a non-raw foo.img raw.
>

With the exception of fixed-size VHD.

But this problem exists today, so there isn't anything 'new' broken
there.  And we can fix that if we want by upgrading probing, to pass
both the first 512 bytes, and the last 512 bytes of the image file.

> 1+2 are the hybrid approach, 3 is the "refuse" idea.
> 
> Adding 3 is an improvement, from "this usage will now break at runtime,
> possibly corrupting data" to "this usage will now be rejected cleanly".
> 
> 3 should also help catch insufficiently selective probe methods.

  reply	other threads:[~2014-11-10 14:25 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-04 18:45 [Qemu-devel] Image probing: how it can be insecure, and what we could do about it Markus Armbruster
2014-11-04 20:33 ` Jeff Cody
2014-11-05  7:04   ` Markus Armbruster
2014-11-05  7:30 ` Markus Armbruster
2014-11-05  8:38 ` Max Reitz
2014-11-05 10:18   ` Eric Blake
2014-11-06 12:43     ` Markus Armbruster
2014-11-06 13:02       ` Eric Blake
2014-11-05 11:15   ` Kevin Wolf
2014-11-06 12:26   ` Markus Armbruster
2014-11-06 12:53     ` Max Reitz
2014-11-06 14:56       ` Jeff Cody
2014-11-06 15:00         ` Max Reitz
2014-11-07 14:52           ` Markus Armbruster
2014-11-07 15:17             ` Max Reitz
2014-11-10  7:58               ` Markus Armbruster
2014-11-07  9:57       ` Markus Armbruster
2014-11-06 13:02     ` Kevin Wolf
2014-11-07 14:50       ` Markus Armbruster
2014-11-05 10:12 ` Gerd Hoffmann
2014-11-05 10:33 ` Eric Blake
2014-11-06 12:52   ` Markus Armbruster
2014-11-05 11:01 ` Kevin Wolf
2014-11-06 13:57   ` Markus Armbruster
2014-11-06 14:14     ` Eric Blake
2014-11-06 15:52       ` Jeff Cody
2014-11-06 14:35     ` Jeff Cody
2014-11-06 15:01     ` Kevin Wolf
2014-11-07 15:21       ` Markus Armbruster
2014-11-07 17:33         ` Jeff Cody
2014-11-10  8:12           ` Markus Armbruster
2014-11-10  9:14             ` Kevin Wolf
2014-11-10 10:30               ` Markus Armbruster
2014-11-10 14:24                 ` Jeff Cody [this message]
2014-11-11  8:28                   ` Markus Armbruster
2014-11-10  8:13         ` Markus Armbruster
2014-11-05 15:24 ` Dr. David Alan Gilbert
2014-11-06 13:04   ` Markus Armbruster

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=20141110142449.GA3365@localhost.localdomain \
    --to=jcody@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).