Metasploit SMB Beginner

Photo by Marten Newhall on Unsplash

In this article, I will guide you through the steps to use Metasploit against an SMB share.

Step 1: Set Up the Environment First, you need to set up a test environment that includes a vulnerable SMB share. You can either set up your own test environment or use a virtual machine. I recommend using a virtual machine, such as VMware or VirtualBox, for ease of use and to avoid causing any damage to your production environment.

Step 2: Identify the Target Once you have set up the environment, the next step is to identify the target machine that you want to exploit. This can be done using a network scanner such as Nmap, which will identify open ports on the target machine. In this case, you are looking for port 445, which is used by the SMB protocol.

Step 3: Select the Exploit Next, you need to select an exploit from the Metasploit database that targets the identified vulnerability. You can search for exploits using the search command in the Metasploit console. For example, you can search for exploits that target SMB using the command: search smb.

Step 4: Configure the Exploit Once you have identified the exploit, you need to configure it for the target machine. This includes setting the target IP address and the payload that will be executed on the target machine. You can set the target IP address using the command: set RHOST <target IP address>. You can also set the payload using the set payload command.

Step 5: Run the Exploit After configuring the exploit, you are ready to run it. You can do this using the exploit command. This will launch the exploit against the target machine and attempt to gain access to the SMB share.

Step 6: Test Access Once the exploit has run successfully, you can test whether you have gained access to the SMB share. You can do this using the show shares command in the Metasploit console. This will show you a list of available shares on the target machine.

Step 7: Clean Up Finally, it is important to clean up after yourself to avoid causing any damage to the target machine. You can do this using the sessions -i <session ID> command, which will allow you to interact with the compromised machine. You can then use the sysinfo and shell commands to check the status of the machine and perform any necessary cleanup tasks.

In conclusion, using Metasploit against an SMB share can be an effective way to test the vulnerabilities of a network. By following these steps, you can successfully exploit the target machine and gain access to the SMB share. However, it is important to remember that this should only be done in a controlled testing environment and with the permission of the owner of the network.

I Love Coffee!



I am interested in various Computer Science topics. I Love Coffee!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store