Skip to content

Mount VHDX/VMDK

Why do we care about a virtual hard drive (especially Windows)? If we can locate a backup of a live machine, we can access theĀ C:\Windows\System32\ConfigĀ directory and pull down theĀ SAM,Ā SECURITYĀ andĀ SYSTEMĀ registry hives. We can then use a tool such asĀ secretsdumpĀ to extract the password hashes for local users.

secretsdump.py -sam SAM -security SECURITY -system SYSTEM LOCAL

When it comes to virtual hard drives there are three specific file types of interest areĀ .vhd,Ā .vhdx, andĀ .vmdkĀ files. These areĀ Virtual Hard Disk,Ā Virtual Hard Disk v2Ā (both used by Hyper-V), andĀ Virtual Machine DiskĀ (used by VMware).

We will use a tool such asĀ SnafflerĀ to crawl network share drives for interesting file extensions such asĀ .kdbx,Ā .vmdk,Ā .vdhx,Ā .ppk, etc.

If we encounter any of these three files, we have options to mount them on either our local Linux or Windows attack boxes.

Linux

Mount VMDK on Linux

guestmount -a SQL01-disk1.vmdk -i --ro /mnt/vmdk

Mount VHD/VHDX on Linux

guestmount --add WEBSRV10.vhdx  --ro /mnt/vhdx/ -m /dev/sda1

Windows

vhd and vhdx files

In Windows, we can right-click on the file and chooseĀ Mount, or use theĀ Disk ManagementĀ utility to mount aĀ .vhdĀ orĀ .vhdxĀ file.

If preferred, we can use theĀ Mount-VHDĀ PowerShell cmdlet.

Mount-VHD -Path c:\test\testvhdx.vhdx

vmdk files

For aĀ .vmdkĀ file, we can right-click and chooseĀ Map Virtual DiskĀ from the menu. Next, we will be prompted to select a drive letter. If all goes to plan, we can browse the target operating system's files and directories.

If this fails, we can use VMWare WorkstationĀ File --> Map Virtual DisksĀ to map the disk onto our base system. We could also add theĀ .vmdkĀ file onto our attack VM as an additional virtual hard drive, then access it as a lettered drive. We can even useĀ 7-ZipĀ to extract data from a .vmdkĀ file.

ThisĀ guideĀ illustrates many methods for gaining access to the files on aĀ .vmdkĀ file.

Last update: 2025-05-18
Created: May 18, 2025 16:41:27