[Libguestfs] Hivex - Trailing garbage at the end of hive file

Subramanian, Hari hsubrama at amazon.com
Wed Oct 2 16:00:23 UTC 2013


Hi Rich,

Sorry about the delayed response. I understand that since hive formats are
not open, the current tack of warning about the hive file is a better one

To respond to you question about "whether it fails", hivexsh is unable to
open the hive file and it prints this message and exits. I've attached the
verbose logs as requested

This extract from the logs shows that the hivexsh complains content after
file offset 0x77c000 is garbage

hivex: badsys: trailing garbage at end of file (at 0x77c000, after 1849
pages) 

So, I went ahead and truncated the contents of the file after that file
offset and hivex was able to successfully open the new hive file

The sizes of the different hive files shown here

[root at ip-10-66-209-246 ~]# ls -als bads*
7664 -rw--w--w- 1 root root 7847936 Oct 1 21:51 badsys (SYSTEM hive file
after truncating trailing garbage)
7680 -rw------- 1 root root 7864320 Oct 1 21:21 badsysback (original
SYSTEM hive file)
16 -rw-r--r-- 1 root root 16384 Oct 1 21:55 badsysgarb (16K of truncated
garbage)


Looking into hive file, the last 16K is what hivex complains to be
trailing garbage. All of that 16K is zeroes.
 

[root at ip-10-66-209-246 ~]# dd if=./badsysback of=./badsysgarb bs=4k
skip=1916
4+0 records in
4+0 records out
16384 bytes (16 kB) copied, 9.1288e-05 s, 179 MB/s


[root at ip-10-66-209-246 ~]# hexdump badsysgarb
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0004000

I'm not sure what the filesystem cluster size is but could the SYSTEM hive
file be padded with 16K of zeroes to match 32k cluster allocation (or
something like that?)

I imported both hive files (original one that hivex complained about and
the truncated one) into a windows regedit and the tool opened them both
fine and showed pretty much the same content

I'm going to see if the hive file I have has any sensitive customer
information and will try to share it if it does not

Thanks for you help!
~ Hari


On 9/25/13 4:59 AM, "Richard W.M. Jones" <rjones at redhat.com> wrote:

>On Tue, Sep 24, 2013 at 09:31:26PM +0000, Subramanian, Hari wrote:
>> Is there a reason why a previous version of hivex ignored this condition
>> while more recent ones throw an error?
>
>We don't understand all aspects of the hive format, so it's better to
>warn about these things than ignore them.
>
>> I do have some hive files that are failing (I'm yet to validate if they
>> are good or were corrupted some other way). I will do so and share my
>> findings
>
>When you say "that are failing" do you mean they actually fail (and if
>so how -- full verbose logs please) or they print this warning, which
>is not a failure?
>
>Rich.
>
>-- 
>Richard Jones, Virtualization Group, Red Hat
>http://people.redhat.com/~rjones
>virt-top is 'top' for virtual machines.  Tiny program with many
>powerful monitoring features, net stats, disk stats, logging, etc.
>http://people.redhat.com/~rjones/virt-top

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hivedebop.bz2
Type: application/x-bzip2
Size: 541005 bytes
Desc: hivedebop.bz2
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20131002/2f3e89da/attachment.bz2>


More information about the Libguestfs mailing list