Windows: WinRM inbound network connections to ports 5985/5986 for PowerShell remoting

Alerts on WinRM inbound connections (ports 5985/5986) consistent with remote PowerShell remoting activity.

FreeReviewedSigma · High · v2
Product
windows
Service
security
Author
Roberto Rodriguez @Cyb3rWard0g (SigmaHQ), DRL 1.1
Published
2019-09-12
Updated
2026-07-31
title: "Windows: WinRM inbound network connections to ports 5985/5986 for PowerShell remoting"
id: 58f6e173-dcca-414f-8e6a-467bf7747731
status: test
description: This rule flags Windows Security events indicating inbound network connections to WinRM ports 5985 (HTTP) or 5986 (HTTPS), consistent with PowerShell remoting over WinRM. Attackers may use remote PowerShell to execute commands on other hosts, so inbound WinRM connectivity can be a key step in lateral movement or remote execution. The detection relies on event 5156 with the correct filtering layer and destination port values in Windows Security telemetry.
references:
  - https://threathunterplaybook.com/hunts/windows/190511-RemotePwshExecution/notebook.html
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/builtin/security/win_security_remote_powershell_session.yml
author: Roberto Rodriguez @Cyb3rWard0g, Huntrule Team
date: 2019-09-12
modified: 2022-10-09
tags:
  - attack.execution
  - attack.t1059.001
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID: 5156
    DestPort:
      - 5985
      - 5986
    LayerRTID: 44
  condition: selection
falsepositives:
  - Legitimate use of remote PowerShell execution
level: high
license: DRL-1.1
related:
  - id: 13acf386-b8c6-4fe0-9a6e-c4756b974698
    type: derived