MaxPatrol SIEM

Detects cyberincidents that undermine cyber resilience of a company

T1021.006: Windows Remote Management

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.

Positive Technologies products that cover the technique

MaxPatrol SIEM knowledge base

mitre_attck_lateral_movement: PT-CR-1371: Evil_WinRM_Activity: The use of the Evil-WinRM tool to remotely execute commands is detected
mitre_attck_lateral_movement: PT-CR-210: Powershell_Remoting: Use of Powershell remoting (WinRM) for remote command execution is detected
mitre_attck_lateral_movement: PT-CR-214: Remoting_Windows_Shell: Windows Remote Shell (WinRS) was used to remotely execute commands
mitre_attck_lateral_movement: PT-CR-216: Remoting_WMI: Detecting using WMI for remote code execution
mitre_attck_lateral_movement: PT-CR-957: Input_Remote_PowerShell_via_WinRM: Remote use of PowerShell cmdlets via the WinRM protocol is detected on an attacked host
mitre_attck_lateral_movement: PT-CR-959: Lateral_Movement_via_WinRM: Remote use of PowerShell cmdlets via the WinRM protocol is detected
mitre_attck_lateral_movement: PT-CR-961: Output_Remote_PowerShell_via_WinRM: Remote use of PowerShell cmdlets on an attacking host via the WinRM protocol is detected

Detection

IDDS0029Data source and componentNetwork Traffic: Network Connection CreationDescription

Monitor for newly constructed network connections using Windows Remote Management (WinRM), such as remote WMI connection attempts (typically over port 5985 when using HTTP and 5986 for HTTPS).

IDDS0029Data source and componentNetwork Traffic: Network Traffic FlowDescription

Monitor network data for uncommon data flows. Processes utilizing the network that do not normally have network communication or have never been seen before are suspicious. Network Analysis frameworks such as Zeek can be used to capture, decode, and alert on RPC network flows.

When a Windows Remote Management connection is opened, the client sends HTTP requests to port 5985 for HTTP or 5986 for HTTPS on the target host. Each HTTP(S) request to the URI “/wsman” is called, and other information is set in the headers. Depending on the operation, the HTTP method may vary (i.e., GET, POST, etc.). This analytic would detect Remote PowerShell, as well as other communications that rely on WinRM. Additionally, it outputs the executable on the client host, the connection information, and the hostname of the target host. Look for network connections to port 5985 and 5986. To really decipher what is going on, these outputs should be fed into something that can do packet analysis.

Note: Traffic to the RPC Endpoint Mapper will always have the destination port of 135. Assuming success, RPC traffic will continue to the endpoint. The endpoint and the client both bind to dynamically assigned ports (on Windows, this is typically greater than 49152). The traffic between the client and endpoint can be detected by looking at traffic to 135 followed by traffic where the source and destination ports are at least 49152.

IDDS0019Data source and componentService: Service MetadataDescription

Monitor use of WinRM within an environment by tracking service execution. If it is not normally used or is disabled, then this may be an indicator of suspicious behavior.

IDDS0009Data source and componentProcess: Process CreationDescription

Monitor for newly executed processes that may use Valid Accounts to interact with remote systems using Windows Remote Management (WinRM), as well as service processes such as wmiprvse.exe on destination hosts.

IDDS0028Data source and componentLogon Session: Logon Session CreationDescription

Monitor for user accounts logging into the system via Valid Accounts to interact with remote systems using Windows Remote Management (WinRM). The adversary may then perform actions as the logged-on user.

IDDS0017Data source and componentCommand: Command ExecutionDescription

Monitor executed commands and arguments that may invoke a WinRM script to correlate it with other related events.

Mitigation

IDM1042NameDisable or Remove Feature or ProgramDescription

Disable the WinRM service.

IDM1026NamePrivileged Account ManagementDescription

If the service is necessary, lock down critical enclaves with separate WinRM accounts and permissions.

IDM1030NameNetwork SegmentationDescription

If the service is necessary, lock down critical enclaves with separate WinRM infrastructure and follow WinRM best practices on use of host firewalls to restrict WinRM access to allow communication only to/from specific devices.