Wherever I get vmdk files, I take a deep breath and wonder what issues might pop up with them. I recently received some vmkd files and when I viewed one of these in FTK Imager (and some other mainstream forensic tools), it showed up as the dreaded "unrecognized file system".
To verify that I had not received some corrupted files, I used the VMWares disk utility to check the partitions in the vmdk file. This tool showed two volumes, so it appeared the vmdk file was not corrupted:
When I tired to mount the vmdk file using vmware-mount, the drive mounted, but was not accessible. A review of their documentation, specifically the limitation section, pointed out that the utility could not mount compressed vmdk files:
You cannot mount a virtual disk if any of its files are encrypted, compressed, or have read-only permissions. Change these attributes before mounting the virtual disk
Bummer. It appeared I had some compressed vmdk files.
So after some Googling and research, I found a couple different ways to deal with these compressed vmdk files - at least until they are supported by the mainstream forensic tools. The first way involves converting the vmdk file, and the second way is by mounting it in Linux.
Which method I choose ultimately depend on my end goals. If I want to bring the file into one of the mainstream forensics tools, converting it into another format may work the best. If I want to save disk space, time and do some batch processing, mounting it in Linux may be ideal.
One of the first things I do when I get an image is create a mini-timeline using fls and some of Harlan's tools. Mounting the image in Linux enables me to run these tools without the additional overhead of converting the file first.
Method 1: "Convert"
The first method is to "convert" the vmdk file.
I'm using "quotes" because my preferred method is to "convert" it right back to the vmdk file format, which in essence, decompresses it.
The vmdk file format is usually much smaller then the raw/dd image and appears to take less time time to "convert".
I used the the free VBoxManger.exe that comes with VirtualBox. This is a command line tool located under C:\Program Files\Oracle\VirtualBox. This tool give you the option to convert the compressed vmdk (or a regular vmkd) into several formats: VHD, VDI, VMDK and Raw. The syntax is:
VboxManage.exe clonehd "C:\path\to\compressed.vmkd" "C:\path\to\decompressed.vmdk" --format VMDK.
It give you a nice status indicator during the process:
Now the file is in a format that can worked with like any other normal vmdk file.
Method 2: Mount in Linux
This is the method that I prefer when dealing with LOTS of vmdk files. This method uses Virtual Box Fuse, and does not require you to decompress/convert the vmkd first.
I had a case involving over 100 of these compressed files. Imagine the overhead time involved with converting 100+ vmdk files before you can even begin to work with them. This way, I was able to write a script to mount each one in Linux, run fls to create a bodyfile, throw some of Harlan's parsers into the mix, and was able to create a 100+ mini-timelines pretty quickly.
There is some initial setup involved but once that's done, it's relatively quick and easy to access the compressed vmdk file.
I'll run though how to install Virtual Box Fuse, how to get the compressed vmkd file mounted, then run fls on it.
1)Install VirtualBox:
sudo apt-get install virtualbox-qt
2) Install Virtual Box Fuse. It is no longer in the app repository, so you will need to download and install the .deb file - don't worry, it's pretty easy, no compiling required :)
Download the .deb from from Launchpad under "Published Versions". Once you have it downloaded, install it by typing:
sudo dpkg -i --force-depends virtualbox-fuse_4.1.18-dfsg-1ubuntu1_amd64.deb
Note - this version is not compatible with Virtual Box v. 4.2. At the time of this writing, when I installed Virtual Box on my Ubuntu distro, it was version 4.1 and worked just fine. If you have a newer version of virtual box, it will still work - you just unpack the .deb file and run the binary without installing it. See the bottom of the thread here for more details.
3)Mount the compressed VMDK file read-only
vdfuse -r -t VMDK -f /mnt/evidence/compressed.vmdk /mnt/vmdk
This will created a device called "EntireDisk" and Parition1, Parition2 etc. under /mnt/vmdk
(even though I got this fuse error - everything seems to work just fine)
At this point and time, you can use fls to generate a bodyfile. fls is included in the Sleuth Kit, and is installed on SIFT by default. You may need to specify the offset for your partition. Run mmls to grab this:
Now that we have the offsets, we can run fls to generate a bodyfile:
fls -r -o 2048 /mnt/vmdk/EntireDisk -m C: >> /home/sansforensics/win7-bodyfile
fls -r -o 206848 /mnt/vmdk/EntireDisk -m C: >> /home/sansforensics/win7-bodyfile
fls -r -o 206848 /mnt/vmdk/EntireDisk -m C: >> /home/sansforensics/win7-bodyfile
Next, if you want access to the files/folders etc, you will need to mount the EntireDisk Image as an ntfs mount for each partition. This is assuming you have an Windows system - if not, adjust the type accordingly:
Mount Partition 1, Offset 2048:
Mount Parition2, Offset 206848:
There are multiple ways to deal with this compressed format, such as using VMWare or VirtualBox GUI to import/export the compresses file... these are just some examples of a couple of ways to do it. I tend to prefer command line options so I can script out batch files if necessary.
I recently had a similar situation, and what I did was open VirtualBox (on Windows), and choose File -> Import Applicance..., pointing the app to the .ovf file that was included. The resulting .vmdk files were decompressed, and I could easily open them in FTK Imager Lite.
ReplyDeleteThanks for sharing this process!
This comment has been removed by the author.
ReplyDelete> Mount Partition 1, Offset 2048:
ReplyDeleteYou likely want to emphasize that offset (TSK returns) here is in sectors and that for a loop back mount you'll have to make this bytes
Method 3: directly run plaso/dfvfs on the VMDK. It uses libvmdk which supports RAW, VMDK (sparse or compressed) and COWD (sparse used by ESX) VMDK images and removes the need to waste of time having by converting your images.
Method 2 alternative: Use vmdkmount as an alternative (https://github.com/libyal/libvmdk/wiki/Mounting) to vdfuse that works on Linux, Mac OS X and Windows. Saves to having to run and maintain the Virtual Box Linux driver.
WinZip 19.5 opens these files directly.
ReplyDelete