Friday, September 21, 2018

Using Metasploit to gain remote access to Metasploitable 2 server by creating a back door

Scenario 2

In this scinario we are trying to gain remote access to the metasploitable 2 server by using Metasploit within Kali.
Step 1: Descover the metasploitable servers IP Address and Open Ports
This is done using the netdiscover command in the linux turminal of Kali. After you have determained the IP address of the server write it down for easy access later In this instance the Targets IP Address is 192.168.152.129. To scan the server for open ports use the nmap -n -sV 192.168.152.129 command.


Figure 16 - Finding open ports on metasploitable server

Step 2: Choose a port to exploit.
In this scinario we are trying to create a backdoor into the metasploitable 2 server. let us see what our options are on port 21 - vsftpd. To do this let us start up our metasplout console by entering msfconsle command. After the console is open let us enter a command that will allow us to see what exploit there are for port 21 – vsftpd by entering search name:vsftpd into the terminal.


Figure 17 - Availible exploits for Port 21 – vsftpd

Perfect we see that there is a exploit that we can use from metasploits library that can creat us a backdoor into the system.
Step 3: Setup  and run exploit
For this step  enter use  exploit/unix/ftp/vsftpd_234_backdoor command  and then the  show options  command to get a list of availible options.


Figure 18 - Port 21 - vsftdp availible options

This step shows us ther we ave to assign the RHOST property by using the target’s IP Address and the following command set RHOST 192.168.152.129 After this has been completed we can enter the following command to show us a list of availible payloads that we can use to explout this port enter show payloads command then set the payload using set payload cmd/unix/interact  and use the  show options command to see if the payload has been set.


Figure 19 - Payload for port 21 Vsftdp is set

After we have established this we can then use the exploit command to deliver the payload and create our backdoor.
As we can see in figure 20 we can now remotly view and edit the content on the metasploitable server.


Figure 20 - Gained remote acess to Metasploutable server

No comments:

Post a Comment

Common practices to reduce your system's vulnerabilities.

  Run regular vulnerability scans – it is recommended that you run a high level scan on your system at least once a month.   Regularly ...