Lateral movement · Windows
winrs.exe
Windows Remote Shell
Runs commands on a remote host over WinRM (WS-Management). A built-in lateral movement tool that does not need an interactive logon, so remote command runs are worth checking.
Legitimate use
Admins use it to run commands on remote servers over WinRM.
Switches
The remote host to run against (-r:host).
MediumAccount for the remote connection.
MediumPassword for the remote connection, in clear text.
MediumEnables administrative mode on the remote shell.
LowCommand lines to worry about
- High
Remote command through WinRM
winrs runs a command on another host over WinRM. Check the target, the account, and whether this source normally uses WinRM.
Detection regex
winrs(\.exe)?\s+.*-r:\S+.*(cmd|powershell|whoami|net |reg )
Where it is recorded
- Security4688Process creation with the full command line, when command-line auditing is enabled.
- Sysmon1Process creation with command line, hashes and parent process.
- WinRM91WinRM created a remote shell session on the target.
- WinRM161WinRM authentication detail on the target.
- Security4624Logon Type 3 on the target for the WinRM connection.
Community detections
1 SigmaHQ rule for winrs.exe. The explainer checks every pasted command line against all of them.
- HighWinrs Local Command Execution
Detects the execution of Winrs.exe where it is used to execute commands locally. Commands executed this way are launched under Winrshost.exe and can represent proxy execution used for defense evasion or lateral movement.
T1021.006T1218by Liran Ravich, Nasreddine Bencherchali
Rules from SigmaHQ (rules/windows/process_creation), Detection Rule License (DRL) 1.1. Each rule links to its source and credits its authors.