Saturday, January 26, 2019

How to remotely install a keylogger onto the victim's computer using Metasploit

In order to install a keylogger on the victim's machine, you first need to be able to gain access to the targeted machine using a reverse_tcp method in Metasploit. I have written a couple of tutorials you can follow to hack and gain access to the victim's computer using Metasploit here, and here. Metasploit came with a built-in keylogger called keyscan, we can use this to log any keystroke once it is installed on the targeted machine.

After you have gained access to the targeted system the first thing you have to do is migrate the meterpreter to the application you want Metasploit to log the keystroke. Follow the steps below to learn how to install the keylogger remotely.

1. When you have successfully exploited the targeted system. In the Meterpreter session type in ps and press Enter. You will be able to see a list of process running on the targeted system. Since I am testing this on my own computer and I am running notepad on it. I can see in the meterpreter that the notepad program is running on my Windows machine with the ID number 912. 

2. Now in order for you to log what the victim is typing on the notepad program, you must migrate the process to the Notepad application before you can start capturing the keystroke on that application. To migrate type in migrate 912 and press Enter. 

3. Now that we have migrated the Meterpreter to the Notepad program, we can embed the keylogger. To start capturing the keystroke type keyscan_start and press Enter. After you have executed the keyscan_start command Meterpreter will start logging whatever the victim is typing inside the Notepad application.

4. To view whatever the victim is typing on his or her Notepad, execute the command keyscan_dump and Meterpreter will immediately dump all of the keystrokes to the Meterpreter session for you to view. 

Note that I have only shown you one example by migrating to the Notepad program. You can be creative and migrate to other application like Internet Explorer, Chrome Browser, Edge browser, Microsoft Word etc. All you have to do is look for the ID number of that process and repeat step 2 to start capturing keystroke on that application.


Post a Comment