Even More Thoughts on Forensics

By Edward Haletky  6 comments

Acquiring disks is a very important part of digital forensics. In my past blogs I discussed some aspects of forensics with respect to VMware ESX servers. This is the last part of the series.

To acquire a VM from a VMFS you must use a forensically sound method. One that duplicates the blocks used by the VM disk, memory, and meta files. Not a method that makes a copy. A copy is not an exact copy as file slack space (the space unused within a block) is ignored. We want this space.

There are several tools that will do this, but only one is currently available on all VMware ESX/ESXi. This is the dd tool. dd will allow you to duplicate the blocks used by the files and not just the files themselves. To copy a file or a directory you need to have some remote or USB storage available that is big enough to hold the data you want to duplicate.

Assuming a USB location that resides on device /dev/sde with a filesystem residing on /dev/sde1 mounted on /mnt/usbdevice, you can use the following to forensically copy a VMs files.

cd /vmfs/volumes/VMName; for x in `ls *.vm*`; do dd if=$x of=/mnt/usbdevice/VMName.vmdk; done

This will make a forensically sound duplicate of the files the comprise the VM. dd has many options, but will use the default blocksize of the file system from which the input file (if option) resides.

Remember to use dd to duplicate minimally the .vmdk, .vmx, .vmsn, and .vswp files.

6 comments

    Anonymous 2 years ago
    Hi Edward,I've been using dd as my disk image capturing software of choice for many years, usually booting a FreeBSD live CD and using dd to get disk images onto a mounted USB disk.However I wanted to point out that from looking at your loop and the input file argument it passes to dd, I see that you are using dd in a non-forensic manner.The use of dd does not automatically mean that every operation you perform with it will be of a forensic quality. Correct procedure is required to do that.dd can be used with input and output at the file level or raw block level (where you either specify a file from a mounted filesystem or raw block device respectively). To provide a forensic quality read of a disk, the input file must be a raw block device and NOT a file within a mounted filesystem from that block device.Unfortunately this is conceptually blurred in UNIX-like operating systems since a raw block device can be considered a "file" and accessed as such. Meaning that this can be confused when providing the input file (if=) to dd (or output file for that matter). The difference between file level and block level requires knowledge of the operating system you are using, since block devices are not always named in the same manner and thus spotting the distinction can be difficult.One of the first rules to capturing a forensic quality disk image is to NOT mount any filesystem within it, which is a part of why I prefer to use a BSD to capture evidence (it will not just mount a disk it finds without asking me).In your example, you are copying non-forensically at the file level from a mounted filesystem! This means that you are not getting slack space data, deleted data and meta data which relates to (but not contained in) the file, etc and you are also continuing to run the risk of losing that required data as long as that filesystem on the source disk is mounted.
    Edward Haletky
    Edward Haletky 3 years ago
    Hello,Re: Using cpActually cp will not do the same job as it does not copy the underlying blocks of the file, but the content of the file. Things are slightly different there. Not if you want true 'duplication' of the underlying blocks. You can use dd to copy files as well as full devices. Unfortunately, until the spec for the VMFS is released, this is the best you can do. dd gives me the opportunity to define the size of the block as well.Re: WorkstationESX uses a Virtual Machine File System to store VMs unlike WorkStation. Since this is unknown to tools like EnCase and FTK, you need to use different mechanisms to get the data off the system.Best regardsEdward L. HaletkyAstroArch Consulting, Inc.
    Anonymous 45 weeks ago in reply to Edward Haletky
    I'm sorry but I still disagree. Your command indicates that you are asking 'dd' to read a vmdk *file*. This of course works, but 'dd' is simply asking the OS for a logical file, it can't access slack this way. Do an strace if you don't believe me. You will see the same pattern for both 'dd' and 'cp':dd if=foo.dd of=bar.dd bs=512:open("foo.dd", O_RDONLY) = 0open("bar.dd", O_WRONLY
    Anonymous 47 weeks ago in reply to Edward Haletky
    As I know, Mr. Edward provides Virtualization, Virtualization Security, Network Security, Secure Coding Consulting and Courseware as well as Linux Security and Application Development. Building Self Esteem
    Anonymous 3 years ago
    I'm a user of VMWare Workstation, not ESX. However, from the above command line, it appears that ESX uses .vmdk files, so simply documenting and copying the entire .vmdk file off of the system for analysis has worked very well for me during engagements. Both FTK Imager and EnCase will allow you to open the .vmdk file and acquire images, without requiring any further VMWare products.For the contents of memory, pausing a VM will create a .vmem file...this is analogous to a dd dump of RAM, and can be analyzed using the available tools.H. Carveyhttp://windowsir.blogspot.com
    Anonymous 3 years ago
    Hi,There appear to be a few flaws with your post.For starters, your dd command will overwrite the output file for each of the files in the *.vm* glob, meaning you will only actually end up with the last one that matched. Perhaps you meant to put the $x somewhere in the output path also?Secondly, I've never used ESX, but it appears that you are accessing the files on a mounted filesystem on the host (some embedded linux IIRC). So what exactly is the point of using 'dd' anyway? 'dd' in this context is ultimately reading from a logical file, not a block device. 'cp' will do exactly the same job.Dave

      Add a comment

      Post a comment using one of these accounts
      Or join now
      At least 6 characters

      Note: Comment will appear soon after you have activated your account.
      Obscene/spam comments will be removed and accounts suspended.
      The information you submit is subject to our Privacy Policy and Terms of Service.

      ITworld LIVE

      VirtualizationWhite Papers & Webcasts

      White Paper

      AppAssure vs Backup Exec

      In this new Lab Report, openBench Labs examines AppAssure backup and replication software v4.7 with Symantec Backup Exec 2010 R2. AppAssure implements changed-block tracking technology to provide data protection for both virtual and physical servers in specific OS environments. In contrast, Backup Exec 2010 R2 uses traditional file-based backup to promote compatibility with the largest number of operating systems.

      White Paper

      Top 5 Requirements for Backup of Virtual and Physical Servers - Greg Shields, Microsoft MVP

      Reports by leading industry analysts like Gartner, IDC and Concentrated Technology suggest virtual servers in 2011 will eclipse physical servers in total server deployments. The majority of today's business computing environments already have both virtual and physical servers at the same time.

      White Paper

      Lab Report - Optimizing VM Backup for VMware and Hyper-V

      Data centers are becoming more difficult to manage and protect as more data and applications are moved into virtual environments. Adding fuel to the fire, CIOs must now deal with corporate mandates to build an IT infrastructure that scales to unknown demand levels and provides service assurance for fluctuating conditions that cannot be accurately projected. The solution is a transition to a private cloud characterized by a hypervisor-independent Virtual Infrastructure (VI).

      Webcast On Demand

      Managing Enterprise Mobility Costs

      Mobile employees, especially those traveling internationally, were spending time and resources finding and making connections. Roaming costs were out of control. The IT Administrator at The Hay Group tells you how he got more control over these costs, providing management with predictable budgets and insights while ensuring employee productivity.

      Sponsor: iPass

      White Paper

      Forrester Total Economic Impact (TEI) Case Study - Oracle

      In this paper, Forrester Consulting examines the total economic impact and potential return on investment (ROI) realized by three Enterprise organizations as they virtualized mission-critical Oracle databases on the VMware vSphere platform. The purpose of this study is to provide readers with a framework to evaluate the potential financial impact of VMware vSphere on their organizations.

      See more White Papers | Webcasts

      Ask a question

      Ask a Question