[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] Auditing a vm image - virt-diff - was: Read MBR and store in a file?



On Fri, Nov 22, 2013 at 05:56:00PM +0000, adrelanos wrote:
> Thank you all for your suggestions!
> 
> Richard W.M. Jones:
> > I keep meaning to write a comprehensive "virt-diff" tool.  I needed it
> > myself just yesterday.
> 
> Most interesting. I guess there are two reasons for creating such a
> tool: just compare the images (show the diff) and/or check for malicious
> additions in the other image.
> 
> Did you consider implementing the former or both?

For all the reasons that Alex goes into, it would just be for checking
NON-malicious differences.  The use case is to reverse engineer what
files change in a guest when you perform an action (eg. install a
Windows driver or run some Linux administrative command).

[...]
> At the moment I am not trying to write a virt-diff like tool, but
> something simpler. A tool to create a report of all of a vm image's
> contents. (Checksums for all files, filesystem, for MBR and Volume Boot
> Record.) When publishing VM images, it might be useful to publish such a
> report together with the image, so others who re-build from source can
> be certain, they ended up with a very similar image. When having created
> two such reports, one could easily get a virt-diff like tool.

I think Matt Booth was doing something like this for Windows systems,
with the aim of being able to recreate a Windows VM from a (smaller)
description.  Don't know what state that was/is in.

[...]
> What other data can there be outside the filesystem?
> 
> I can think of:
> 
> - MBR
> - Volume Boot Record
> 
> Anything else?

Potentially all unused space inside and between partitions /
filesystems / logical volumes.  The boot loader is sometimes stored in
the space between the MBR and the first partition.  Other peculiar
things lie in other spaces.

However if you don't care about guests that are malicious / hiding
data, then you can ignore everything except for the MBR and any
non-zero data between the MBR and the first partition.  Note for GPT
you have to take into account two partition tables as well.

> If these have been compared, the compared image should be as safe to use
> as the original one?
> 
> (I could imagine that there can be extra data outside filesystem, maybe
> in regions outside the partition table, but those data shouldn't get
> executed after starting the image in a VM.)

For Linux guests, you could boot from an external kernel & initrd ...

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]