T1021.006

Windows Remote Management

Adversaries may use Valid Accounts to interact with remote systems using Windows Remote Management (WinRM). WinRM is a Windows service and protocol allowing remote execution of commands, registry modification, and service management. It can be invoked via the winrm command, PowerShell's Invoke-Command/Enter-PSSession, or tools like Evil-WinRM used by Storm-0501. Other users include Cobalt Strike (WinRM for Beacon delivery), Brute Ratel C4, Chimera, and FIN13. WinRM operates over HTTP (5985) and HTTPS (5986) and requires valid credentials plus network access. When disabled by default on client systems, adversaries may first enable it via registry modification or Group Policy.

Microsoft Sentinel / Defender
kusto
// Detect WinRM lateral movement — remote command execution and suspicious WinRM usage
DeviceProcessEvents
| where Timestamp > ago(24h)
// Pattern 1: wsmprovhost.exe spawning suspicious children on destination (remote execution)
| where InitiatingProcessFileName =~ "wsmprovhost.exe"
| where FileName !in~ ("conhost.exe", "WerFault.exe")  // Exclude normal WinRM child processes
| extend Pattern = "WinRM_RemoteExec"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
         InitiatingProcessFileName, Pattern
| union (
    // Pattern 2: PowerShell WinRM usage (Invoke-Command, Enter-PSSession, New-PSSession)
    DeviceProcessEvents
    | where Timestamp > ago(24h)
    | where FileName in~ ("powershell.exe", "pwsh.exe")
    | where ProcessCommandLine has_any (
        "Invoke-Command", "Enter-PSSession", "New-PSSession",
        "winrm", "PSSession", "-ComputerName", "WSMan"
      )
    | where ProcessCommandLine has_any ("-ComputerName", "-Session", "wsman://")
    | extend Pattern = "WinRM_PSRemoting"
    | project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
             InitiatingProcessFileName, Pattern
)
| union (
    // Pattern 3: winrm.cmd or winrs.exe execution
    DeviceProcessEvents
    | where Timestamp > ago(24h)
    | where FileName in~ ("winrs.exe", "winrm.cmd")
    | extend Pattern = "WinRM_DirectTool"
    | project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
             InitiatingProcessFileName, Pattern
)
| sort by Timestamp desc
high severity high confidence

Data Sources

Process: Process Creation Command: Command Execution Network Traffic: Network Connection Creation Microsoft Defender for Endpoint

Required Tables

DeviceProcessEvents DeviceNetworkEvents

False Positives

  • IT administrators using PowerShell remoting (Enter-PSSession, Invoke-Command) for legitimate remote system management
  • SCCM/Intune and other configuration management platforms that use WinRM for remote script execution
  • Monitoring agents (SCOM, Datadog, SolarWinds) that collect data via WinRM
  • Ansible on Windows using WinRM as its transport layer for configuration management playbooks
  • Automated patch management and software deployment processes that leverage PowerShell remoting

Unlock Pro Content

Get the full detection package for T1021.006 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections