WinRM

MITRE ATT&CK™ Remote Services: Windows Remote Management - Technique T1021.006

Theory

Adversaries may use Valid Accounts to interact with remote systems using Windows Remote Management (WinRM). The adversary may then perform actions as the logged-on user.

WinRM is the name of both a Windows service and a protocol that allows a user to interact with a remote system (e.g., run an executable, modify the Registry, modify services). It may be called with the winrm command or by any number of programs such as PowerShell. WinRM can be used as a method of remotely interacting with Windows Management Instrumentation.

Practice

Execute Remote Commands

We can use netexec to remotely execute a command on the target over WinRM.

#Execute command
netexec winrm <IP> -u <user> -p <password> -x "whoami"

#Execute PowerShell command
netexec winrm <IP> -u <user> -p <password> -x "$(Get-WMIObject -class Win32_ComputerSystem | select username).username"

Remote shell

Evil-winrm can be use to obtain a winrm powershell session

evil-winrm -u <user> -p <password> -i <IP>

Resources

Last updated