Lateral movement
WinRM and PowerShell Remoting
Enter-PSSession / Invoke-Commandwinrsevil-winrm
Remote execution over WinRM (ports 5985/5986). On the destination the payload runs as a child of wsmprovhost.exe.
Artifacts by host
Every place this technique leaves a trace. Collect all three sides; each one fills gaps the others leave.
Source
Where the operator ran the tool
Destination
The machine being accessed
- Security4624
Network logon, LogonType 3, for the account authenticating over WinRM.
- WinRM91
The WinRM service creating a shell (session) on the destination for the inbound request.
- Sysmon1
wsmprovhost.exe spawned, and the remote commands running as its children.
- Security4688
The same execution in the Security log, ParentProcessName wsmprovhost.exe, with command-line auditing.
- PowerShell4104
Script block logging captures the remote PowerShell code after de-obfuscation, when enabled.
- PowerShell4103
Module logging records pipeline execution details of the remote commands, when enabled.
- Prefetch: C:\Windows\Prefetch\WSMPROVHOST.EXE-*.pf
Execution evidence for the WinRM host process on the destination.
Domain controller
Authentication records
- Security4769
Kerberos service ticket for the destination: ServiceName is the destination computer account (DEST$) for the HTTP/<dest> (or WSMAN/<dest>) SPN, and IpAddress is the source host. The DC-side record that ties source, account and destination together.
- Security4768
TGT request for the account from the source IP, when it had no valid TGT yet (for example right after runas or an explicit-credential logon on the source).
- Security4776
NTLM credential validation with Workstation set to the source name, when NTLM was used instead of Kerberos (destination addressed by IP, or pass-the-hash). Domain accounts only; local accounts are validated on the destination.
Fingerprints
Strings and values specific enough to search for directly.
- 01Parent process wsmprovhost.exe on the destination
- 02Destination ports 5985 (HTTP) and 5986 (HTTPS)
- 03WinRM service (WinRM) servicing the inbound connection
- 044624 LogonType 3 paired with a wsmprovhost.exe process tree
- 05evil-winrm leaves the same wsmprovhost.exe parentage as native remoting
How it works
PowerShell Remoting runs over WinRM, Microsoft's SOAP-over-HTTP management transport, on port 5985 (HTTP) or 5986 (HTTPS). Enter-PSSession and Invoke-Command open a session to the target, where the WinRM service hands the work to a host process, wsmprovhost.exe, which executes the remote commands. The defining destination artifact is therefore wsmprovhost.exe as the parent of whatever the operator runs. On the source the WinRM client records the session it is creating and the destination it connects to; on the destination the WinRM service records inbound shell creation, a network logon occurs, and PowerShell script block logging captures the commands if it is enabled. evil-winrm and similar tools use the same transport and leave the same wsmprovhost.exe parentage.
Hunt queries
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=1} |
Where-Object { $_.Message -match 'ParentImage:.*wsmprovhost.exe' }Benign look-alikes
- Legitimate administration via PowerShell Remoting and Invoke-Command.
- Configuration management (DSC, Ansible over WinRM) and monitoring tools.
- Automated jobs that fan out commands across servers during maintenance.