T1021.006 Elastic Security · Elastic

Detect Windows Remote Management in Elastic Security

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.

MITRE ATT&CK

Tactic
Lateral Movement
Technique
T1021 Remote Services
Sub-technique
T1021.006 Windows Remote Management
Canonical reference
https://attack.mitre.org/techniques/T1021/006/

Elastic Detection Query

Elastic Security (Elastic)
eql
process where event.type == "start" and
(
  /* Pattern 1: wsmprovhost.exe spawning suspicious children — remote exec on destination */
  (
    process.parent.name : "wsmprovhost.exe"
    and not process.name : ("conhost.exe", "WerFault.exe", "csc.exe")
  )
  or
  /* Pattern 2: PowerShell WinRM remoting cmdlets */
  (
    process.name : ("powershell.exe", "pwsh.exe")
    and process.command_line : (
      "*Invoke-Command*", "*Enter-PSSession*", "*New-PSSession*",
      "*-ComputerName*", "*wsman://*", "*WSMan*"
    )
  )
  or
  /* Pattern 3: Direct WinRS / WinRM tool usage */
  process.name : ("winrs.exe", "winrm.cmd")
)
high severity high confidence

Detects WinRM lateral movement (T1021.006) using three ECS process-launch patterns: (1) wsmprovhost.exe spawning non-standard child processes, indicating remote command execution on the destination host; (2) PowerShell using WinRM remoting cmdlets such as Invoke-Command, Enter-PSSession, or New-PSSession targeting remote hosts; (3) direct use of winrs.exe or winrm.cmd for remote execution.

Data Sources

Elastic Endpoint Security (elastic-agent)Winlogbeat with Sysmon EventID 1Auditbeat (process module)

Required Tables

logs-endpoint.events.process-*winlogbeat-*logs-windows.sysmon_operational-*

False Positives & Tuning

  • Legitimate IT automation using PowerShell Remoting for patch management or configuration management tools (SCCM, Ansible WinRM provider, DSC pull servers) — expect high volume from management hosts
  • System administrators using Enter-PSSession or Invoke-Command interactively for routine remote diagnostics; baseline by source host and account to distinguish admin PAWs from endpoints
  • Monitoring and backup agents that spawn child processes under wsmprovhost.exe during scheduled maintenance windows — whitelist known agent binaries by hash or path
Download portable Sigma rule (.yml)

Other platforms for T1021.006


Testing Methodology

Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Execute Remote Command via WinRM (Invoke-Command)

    Expected signal: Sysmon Event ID 1: powershell.exe with Invoke-Command and ComputerName in command line. Sysmon Event ID 3: outbound TCP to 127.0.0.1:5985. On target: wsmprovhost.exe spawning child process (Get-Process execution). WinRM Operational Event ID 91.

  2. Test 2Enable WinRM on Remote Host via Registry

    Expected signal: Sysmon Event ID 1: powershell.exe with Enable-PSRemoting. Sysmon Event ID 13 (Registry Value Set): changes to WinRM configuration registry keys under HKLM\SOFTWARE\Policies\Microsoft\Windows\WinRM. WinRM service start in System log.

  3. Test 3Execute Remote Command via winrs.exe

    Expected signal: Sysmon Event ID 1: winrs.exe process creation with -r: and remote IP. Sysmon Event ID 3: network connection to 127.0.0.1:5985. On target: wsmprovhost.exe spawning cmd.exe with 'whoami & hostname'.

  4. Test 4Interactive WinRM Session via Enter-PSSession

    Expected signal: Sysmon Event ID 1: powershell.exe with New-PSSession and ComputerName 127.0.0.1. Sysmon Event ID 3: TCP connection to 5985. WinRM Operational Events 6, 11, 15 (create, shell, command). ScriptBlock Log Event 4104 with Get-LocalUser.

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