Back to Posts

Metasploitable 3 Install

Posted in Pentesting

 Checkout SlayerLabs.com!
Networks Engineered to Exploit.
- Windows/UNIX - Domains/Subnets - Initial/Post/Lateral - Low Cost VPN Ranges -


Install Metasploitable

Here’s the process to install metasploitable 3 on Windows and Kali Linux. I had a hell of a time getting it working properly, so decided to throw my quick and dirty notes together.

The best thing to do is follow the README.txt in the metasploitable 3 repository. Some things have changed since its release, causing the install process to be slightly different. Following an old guide from a forum post 3 years ago may cause a serious headache.

Install directions will be versions:

Windows 10 Pro
Vagrant 2.1.2
Packer 1.2.4
Virtual Box 5.2.14

AND

Kali-4.16.0
Vagrant 2.1.2
Packer 1.0.4
Virtaul Box 5.2.12


Kali Linux


First we’ll need to install the pre-reqs. Make sure to update your box before you begin.

apt-get update

On Kali, vagrant was giving me dependency issues (json, etc) and virtualbox was giving me this error:

root@kali:~# virtualbox 
WARNING: The character device /dev/vboxdrv does not exist.
     Please install the virtualbox-dkms package and the appropriate
     headers, most likely linux-headers-amd64.

     You will not be able to start VMs until this problem is fixed.

Prior to your install I’d recommend to run a dist-upgrade, since that solved the dependency issues I was runing into. use

apt-get purge --remove vagrant

to completely remove it for a fresh install.

apt-get dist-upgrade

Install Packer

apt-get install packer

Install Vagrant

Download and install Vagrant manually. Download Vagrant from the downloads page on it’s main website (Debian x64 or x32 for kali linux). Then run:

dpkg -i vagrant*.deb

Check the version to make sure it downloaded correctly

vagrant --version

Now install the vagrant-reload plugin.

vagrant plugin install vargrant-reload

Download virtualbox

I was having issue getting virtual box working with Kali. Eventually an unknown combination of updating, reconfiguring and downloading manually I eventaully go it working. First try:

apt-get install dkms
apt-get install virtualbox

Download and Install Metasploitable 3

Clone metasploitable in your favorite project directory…

git clone https://github.com/rapid7/metasploitable3.git

We’ll build it manually which is very simple and will cause less of headache.

Go to packer/templates/ then

packer build windows_2008_r2.json

This will take awhile, maybe 30-60 minutes. Hopefully you don’t get any errors. If not move on to add the .box file. Make sure you directories and file names are the same…

vagrant box add ../builds/windows_2008_r2_virtualbox_0.1.0.box

This will take a while as well. One complete without error run:

vagrant up

If you get an error similar to:

Error 67
The network name cannot be found

Solution was found here: https://github.com/rapid7/metasploitable3/issues/246

Basically you’ll want to change the ip in the setup_linux_share.bat (at the time located in metasploitable3/scripts/installs/). Just update the last octet from 3 to 8, for simplicity. Then restart the process using the –provision flag.

If you get an error related to the ubuntu image not being found run

vagrant up win2k8

ssh into box via powershell to check

vagrant ssh win2k8

The Metasploitable 3 VM should noe be populated in Virtaul Box. Use vagrant:vagrant to login and be sure to check networking as you Kali box may be configured a bit differently.

Windows

Packer

packer.io > Downloads > Windows 10 > Download & unzip (do not run yet)

Create a folder for Packer > C: > Program Files > Packer

Copy Packer.exe to this folder. Now we need to add packer to our PATH.

Go to Windows > Advanced System Settings > Environment Variables > Within System Variable, edit Path and add:

 %ProgramFiles%Packer

Ok and close. To test open cmd and enter: packer --version


Vagrant

Download the vagrant Windows 10 version on vagrants site, then run the vagrant msi file. Click next, next, etc you can leave everything as default. Restart you machine as directed.

Open cmd after reboot, and to test enter: vagrant --version

The vagrant-reload plugin is also required for metasploitable 3. Simply type

vagrant plugin install vagrant-reload

You should see a success message once complete.


Virtual Box

Make sure to download the latest version of Virtual Box. Simply download from the Oracle Virtaul Box site and execute. ___ Download and Install Metasploit

Clone Metasploitable 3’s repository through git on Windows, otherwise download it manually. Now use packer to build the json file - the next 3 commands take a long time. Plan for about 60ish minutes.

packer build windows_2008_r2.json

use vagrant to build the box…

vagrant box add ../builds/windows_2008_r2_virtualbox_0.1.0.box

Then..

vagrant up

If you get an error similar to:

Error 67
The network name cannot be found

Solution was found here: https://github.com/rapid7/metasploitable3/issues/246

Basically you’ll want to change the ip in the setup_linux_share.bat (at the time located in metasploitable3/scripts/installs/). Just update the last octet from 3 to 8, for simplicity. Then restart the process using the –provision flag.

If everything goes smooth you can check if the VM is running by using a built-in Virtual Box command line tool.

.\VBoxManage.exe list runningvms

You should see it running.

Misc.

A few misc. notes to help with installation trouble-shooting.

vagrant global-status
vagrant global-status --prune
vagrant ssh win2k8
vagrant halt win2k8
vagrant suspend win2k8

Custom Cyber Ranges >>

https://slayerlabs.com

Read Next

Private-i