Mounting VHD files in Kali Linux through remote share(smb).

cyber thot
Jun 27 · 2 min read

What is vhd ?

VHD (Virtual Hard Disk) is a file format which represents a virtual hard disk drive (HDD). It may contain what is found on a physical HDD, such as disk partitions and a file system, which in turn can contain files and folders. It is typically used as the hard disk of a virtual machine

How we can @3use it in Pentesting Scenario?

Some Times you get vhd files on remote share but these very large files not a good idea to download it in our local system so in this case we can mount remote share.

first download some tools

apt-get install cifs-utils

apt-get install libguestfs-tools

Quick Google Search Result

The in-kernel CIFS filesystem is generally the preferred method for mounting SMB/CIFS shares on Linux.

The in-kernel CIFS filesystem relies on a set of user-space tools. That package of tools is called cifs-utils. Although not really part of Samba proper, these tools were originally part of the Samba package. For several reasons, shipping these tools as part of Samba was problematic and it was deemed better to split them off into their own package.

libguestfs is a set of tools for accessing and modifying virtual machine (VM) disk images. You can use this for viewing and editing files inside guests, scripting changes to VMs, monitoring disk used/free statistics, creating guests, P2V, V2V, performing backups, cloning VMs, building VMs, formatting disks, resizing disks, and much more.

so now how i can mount ?

lets assume out target i.p is and share name is root

mount -t cifs // -o user=guest,password= /mnt/root

we mount the share successfully but can’t read vhd files hmm..

now let’s say there is a vhd file in root directory called target.vhd

guestmount — add /mnt/root/target.vhd — inspector — ro /mnt/vhd

cd /mnt

ls -la