Scan for NFS Shares
In this step, you will use the Metasploit Framework to scan the target machine for NFS shares.
Now you will start the attack machine (Kali Linux container) and the target machine (Metasploitable2 virtual machine) for the experiment.
- Open an xfce terminal on the LabEx host machine and start the Metasploitable2 target by running the following command:
sudo virsh start Metasploitable2
- Test the connectivity to the target machine by pinging it:
ping 192.168.122.102
Press Ctrl+C
to stop the ping.
- Launch the Kali Linux container and enter the bash environment by running:
docker run -ti --network host --privileged b5b709a49cd5 bash
There is an extra --privileged
parameter, which is used so that the root inside the container has real root privileges, otherwise the root inside the container is just a normal user with external privileges. Starting a container with the --privileged
parameter will allow you to see many of the devices on the host and perform a mount
, and will even allow you to start docker containers within docker containers.
- Inside the Kali container, test the network connection to the target machine:
ping 192.168.122.102
Press Ctrl+C
to stop the ping.
Now both the attack machine and the target machine are running, and you can start the penetration testing.
- Now, launch the Metasploit console:
cd ~
msfconsole
- In the Metasploit console, use the
auxiliary/scanner/nfs/nfsmount
module to scan for NFS shares:
use auxiliary/scanner/nfs/nfsmount
set rhosts 192.168.122.102
set threads 5
show options
exploit
This module will scan the target system and display any exported NFS shares.
Press Ctrl+D to quit the Metasploit console then start the inspection