WinRM (Windows Remote Managament) for Lateral Movement
Requirements:
- Credentials (password, NT hash, Kerberos TGT) of a member of the local Administrators or Remote Management Users group on the target machine.
- WinRM enabled on target host (enabled by default on Windows Server, disabled by default on client Windows).
- WinRM allowed on firewall (allowed by default).
WinRM is enabled by default on Windows Server 2012 and above. It's disabled by default on client Windows. All of the WinRM communication is over a single port (5985/TCP for HTTP, 5986/TCP for HTTPS). Logon via WinRM is of the Network type (no reusable credentials). However, in Windows built-in tooling there's a way to delegate credentials to established session (below). By default, if you want to use WinRM, you need to be a local administrator on the target machine.
Linux:
Windows (winrs):
IMPORTANT: Using
winrs
the-r
parameter must be provided as hostname, not an IP address.
PowerShell Remoting
Powershell has built-in ability to run commands remotely on different machines - so-called PowerShell Remoting feature. It's achived using WinRM protocol under the hood. It's commonly used in enterprise management tasks so it's not very suspicious.
Windows:
Enable WinRM with PowerShell
If you have administrative access to the machine (e.g. via SmbExec or RDP) you can activate WinRM with PowerShell.