Detect Windows Remote Management in CrowdStrike LogScale
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/
LogScale Detection Query
#repo=base_sensor #event_simpleName=ProcessRollup2
| eval AlertType = if(
match("(?i)wsmprovhost\\.exe", ParentBaseFileName)
AND !match("(?i)(conhost|WerFault|csc)\\.exe", FileName),
"WinRM_RemoteExec",
if(
match("(?i)(powershell|pwsh)\\.exe", FileName)
AND match("(?i)(Invoke-Command|Enter-PSSession|New-PSSession|-ComputerName|wsman://|WSMan)", CommandLine),
"WinRM_PSRemoting",
if(
match("(?i)winrs\\.exe", FileName),
"WinRM_DirectTool",
null()
)))
| where isNotNull(AlertType)
| table(
[ timestamp, ComputerName, UserName, FileName,
CommandLine, ParentBaseFileName, AlertType ]
)
| sort(timestamp, order=desc, limit=500) CrowdStrike LogScale (Falcon) CQL query detecting WinRM lateral movement using ProcessRollup2 telemetry from the Falcon sensor. Uses nested eval with match() for regex-based classification into three alert types: WinRM_RemoteExec (wsmprovhost child processes), WinRM_PSRemoting (PowerShell with remoting cmdlets), and WinRM_DirectTool (winrs.exe). Null results are filtered out, leaving only WinRM-related process events.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate remote administration via PowerShell Remoting from approved IT management hosts — tune by adding a NOT match() condition scoped to known management host ComputerName values or a reference list of privileged workstations
- Endpoint management solutions (Tanium, BigFix, Ivanti) that leverage WinRM as a remote execution transport on managed Windows endpoints — these generate predictable parent-child process chains that can be whitelisted by ParentBaseFileName or ParentProcessId lineage
- Automated DevOps pipelines using Ansible WinRM transport or PowerShell New-PSSession to provision or test remote Windows build agents — correlate with deployment schedules and CI/CD service account names to suppress during expected maintenance windows
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.
- 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.
- 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.
- 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'.
- 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.
References (8)
- https://attack.mitre.org/techniques/T1021/006/
- https://learn.microsoft.com/en-us/windows/win32/winrm/portal
- https://learn.microsoft.com/en-us/powershell/module/microsoft.wsman.management/
- https://github.com/Hackplayers/evil-winrm
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1021.006/T1021.006.md
- https://www.nccgroup.com/uk/about-us/newsroom-and-events/blogs/2021/january/chimera-apt-targeting-semiconductor-vendors/
- https://www.microsoft.com/security/blog/2023/09/14/peach-sandstorm-password-spray-campaigns-enable-intelligence-collection-at-high-value-targets/
- https://docs.microsoft.com/en-us/archive/blogs/jepayne/2014-02-03-lateral-movement-winrm
Unlock Pro Content
Get the full detection package for T1021.006 including response playbook, investigation guide, and atomic red team tests.