Kali Linux & Metasploit: Getting Started with Pen Testing
By: Nicholas Handy
Tags: Metasploit, Kali Linux, Linux, Cybersecurity, Penetration Testing

Metasploit Framework

The Metasploit Framework is an open source penetration testing and development platform that provides exploits for a variety of applications, operating systems and platforms. Metasploit is one of the most commonly used penetration testing tools and comes built-in to Kali Linux.

The main components of the Metasploit Framework are called modules. Modules are standalone pieces of code or software that provide functionality to Metasploit. There are six total modules: exploits, payloads, auxiliary, nops, posts, and encoders. We will just focus on exploits and payloads.

Exploit

An exploit takes advantage of a system’s vulnerability and installs a payload.

Payload

The payload gives access to the system by a variety of methods (reverse shell, meterpreter etc.)

We will us both of these to gain access to the victim machine in the exercise detailed later.

Environment Setup

Virtualbox is an operating system emulation software that gives us the ability to run additional systems from our local machine.

Kali Linux will be our local machine where we can run our attacks from. Since we will need both Kali and the Metasploitable vulnerable machine running we will use Virtualbox to emulate both environments. To login to Kali: username is root & password is toor.

Metasploitable 2 is designed to be vulnerable in order to work as a sandbox to learn security. This will provide us with a system to attack legally. Most of the vulnerabilities on Metasploitable are known so there are tons of resources available to help learn various attack types.

Metasploit is a framework within Kali to run attacks on other systems. Metasploitable is a vulnerable system that can be used as a target for attacks and security testing.

Metasploitable Installation

The pictures below show the settings to setup a new virtual machine for Metasploitable.

Metasploitable shouldn’t need more than 256MB of ram but you can add more if your system can handle it.

Instead of creating a new hard disk the Metasploitable machine we downloaded will act as our existing virtual hard disk.

We do not want the Metasploitable machine on our actual network, so configure the settings for that machine as below. Make sure the Kali machine is also on the Host-Only Adapter. (Settings or tabs not shown in the pictures below were left as default)

Main settings page for Metasploitable

Make sure to change the network settings to Host-only

Make sure to change the network settings for Metasploitable to host-only adapter

Once we are done changing the settings we can start Metasploitable. The login and password are both: msfadmin. After logging in we can leave it running and start up Kali Linux. From there we can work with the Metasploit framework on Kali Linux.

Note: When entering password it won’t show on the screen

Exploiting VSFTPD v2.3.4 Backdoor Command Execution

Now that everything is setup we can focus on how we can break into the Metasploitable 2 machine from our Kali Linux VM.

With Metasploitable 2 most if not all the vulnerabilities are known. But that is not usually the case. For systems in the wild there is many more steps to get into a unknown system or network. To get comfortable with the Metasploit Framework we can look up vulnerabilities online to get comfortable with the workflow.

For this walk-through we will focus on VSFTPD v2.3.4. This vulnerability will provide root shell using Backdoor Command Execution. This means we will have full access to Metasploitable 2’s command line.

Step 1: Start the Metasploit Console

Open the command terminal inside Kali and type