Upgrade from A Shell Session into Meterpreter Session Using Metasploit

If we talk about Metasploit notably in Kali Linux, there is no enough time for discussing it. Eventhough it is a free version (not enterprise or Pro version), Metasploit Community version is fully enough for us to exploit a vulnerable system.

As described at their website, Rapid7 claimed that metasploit is the world’s most used penetration testing framework. It does not exaggerate for them to claim that. Because if I search about pentest in youtube for example, many people use metasploit for presenting how to exploit a system.

In this session, I will show you how to migrate or upgrade our session from a shell session into meterpreter session. The question that is arised on ypur mind is Wht should we migrate our shell session into meterpreter session ? what is the advantages of the meterpreter session notably if compared with the shell session.

From https://null-byte.wonderhowto.com, there was a question about what is the difference between Meterpreter and Shell. The difference is on both the types and abilities of command. The shell session just gives you a basic command line to control the victim with. The meterpreter however gives an immense control over the vicitim. Through meterpreter session, we can create a payload to launch the exploiting action.

Back to the mind topic. Let’s start the steps:

The Scenario

” There is a vulnerable machine which is running on Ubuntu 16 Operating System. The vulnerability is a weak password of SSH service on port 22″.

The first, I set up my nmap tools for scanning the services that run on the machine. After launching the nmap, I get the result like picture below:

The second, I prepare my metasploit “armour” to exploit the hint as described in the Scenario. I use auxiliary modul called “ssh_login” which is lolcated at “auxiliary/scanner/ssh/ssh_login”. There are several parameters which should be set up like picture below:

 as described by the picture above, the worldist I used is rockyou.txt. The IP Address of the target machine was And I just set the username as “root”.

After all parameters was set up correctly, launched the attack by typing “exploit”. The result of the exploit is described by the picture below:

 The last is how to upgrade it into meterpreter session. Obviously, Metasploit Community version has a post module which is located at “post/multi/manage/shell_to_meterpreter”.  The module is used for changing our shell session into meterpreter session. The parameters of this module are like picture below:

  The payload is running on port 4433 by default or elseones depend on we wanna to be. After we run the module successfully, it will created a new session – for this scenario is session 2. The new session is meterpreter session. We can check this by typing “sessions -l” like picture below:

Thus, my tutorial for upgrading our shell session into meterpreter session. Hopefully, it could become a usefull way when exploit a vulnerable machine.


Leave a Reply

Your email address will not be published. Required fields are marked *