IMPORTANT NOTE: At the time of writing, Metasploitable 2 has no synthetic drivers for Hyper-V and so cannot communicate with the server via a virtual switch, even using the drives from the Linux Integration Services (https://www.microsoft.com/en-us/download/details.aspx?id=55106)
In preparation for some ethical hacking sessions I’m running soon, I wanted a hypervisor I could easily spin up virtual servers on (or run multiple targets on) and was easy to manage. As I had a decommissioned server and a Microsoft Server 2012 R2 license for it, I decided to use that with Hyper-V for the virtualisation.
Get the MetaSploitable VM
Once downloaded, unzip the file and you’ll see the following files in it:
The key file there – as you can probably tell from the file size of around 1.7GB – is Metasploitable.vmdk. Unfortnately for us, this is a type of virtual machine file format used by VMWare (and also VirtualBox) but not supported by Hyper-V.
Converting the VM
Fortunately Microsoft realised this could impact take up of Hyper-V and so have provided a free conversion tool, the Microsoft Virtual Machine Converter which you can download from here:
Once you have downloaded and installed the program, you need to use Powershell to do a simple conversion:
Open a Powershell windows with administrative privilrges
Exectute the following Powershell command:
Import-Module 'C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1'
You’ll need to consider the format of the disk you want (either VHD or VHDX) and the type of disk (FixedHarddisk or DynamicHarddisk) and list in this format:
ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath c:\downloads\VM-disk1.vmdk -VhdType DynamicHardDisk -VhdFormat vhdx -destination d:\vm-disk1
Once it starts running, you should see a progress bar similar to this:
Creating the MetaSploitable Hyper-V VM
- Open the Hyper-V Manager
- In the left pane, right click and select New > Virtual Machine
- In the New Virtual Machine Wizard click Next
- Give your VM a suitable name, for example “MetaSploitable 2”
- Check the option for Store the virtual machine in a different location, click Next
- Select Generation 1, click Next
- Change the Startup memory to 2048MB, click Next
- Select the appropriate Connection in the drop-down, click Next
- Check the option for Use an existing virtual hard disk
- Click Browse and locate the converted hard disk file, click Next
- Click Finish
When you start the VM, you should see something like this:
How you configure the network options for Metasploitable really depends on how you plan to use it. For me, I am generally run it on a server and I map it to a specific physical port on the server because I am using it for training on a non-business network.
Accessing Metasploitable 2
Once you have started the machine in Hyper-V, you can login via following credentials: