name: detecting-lateral-movement
description: >-
Detect adversary lateral movement across Windows and Linux environments.
Covers PsExec, WMI, RDP, SSH, SMB, WinRM, and DCOM abuse with Sigma rules,
KQL/SPL queries, and network-based detection strategies.
domain: cybersecurity
subdomain: blue-team
tags:
- lateral-movement
- detection-engineering
- threat-hunting
- mitre-attack
- windows
- network-security
version: "1.0"
author: defconxt
license: AGPL-3.0
metadata:
mitre-attack: ["T1021.001", "T1021.002", "T1021.003", "T1021.004", "T1021.006", "T1550.002"]
Detecting Lateral Movement
Overview
Lateral movement (MITRE ATT&CK Tactic TA0008) allows adversaries to pivot
through a network after initial access. Detection requires correlating
authentication events, service creation, network connections, and process
execution across multiple hosts and log sources.
Prerequisites
| Requirement |
Purpose |
| Windows Event Forwarding |
Centralized Security/Sysmon logs |
| Sysmon with EID 1,3,17,18 |
Process, network, pipe events |
| Network flow data |
East-west traffic visibility |
| SIEM with cross-host correlation |
Multi-source join capability |
Key Concepts
Lateral Movement Techniques
| Technique |
ATT&CK ID |
Telemetry Sources |
| PsExec |
T1021.002 |
EID 7045 (PSEXESVC), EID 4624 Type 3, Sysmon EID 17/18 |
| WMI |
T1021.003 |
EID 4624 Type 3, Sysmon EID 1 (wmiprvse child) |
| RDP |
T1021.001 |
EID 4624 Type 10, EID 1149 (TerminalServices) |
| WinRM |
T1021.006 |
EID 4624 Type 3, EID 91/168 (WinRM Operational) |
| SSH |
T1021.004 |
auth.log, sshd accepted/failed entries |
| DCOM |
T1021.003 |
Sysmon EID 1 (mmc.exe/dllhost child), network 135 |
| SMB |
T1021.002 |
EID 5140/5145 (share access), Sysmon EID 3 port 445 |
| Pass-the-Hash |
T1550.002 |
EID 4624 Type 3 + NTLM, LogonProcessName NTLMSSP |
PsExec Detection (Sigma)
title: PsExec Service Installation
id: c3f7a8d2-1b4e-4f6a-9d2c-8e7f5a3b6c1d
status: experimental
description: Detects PsExec service installation indicating lateral movement
logsource:
product: windows
service: system
detection:
selection:
EventID: 7045
ServiceName|contains:
- 'PSEXESVC'
- 'psexec'
condition: selection
falsepositives:
- Legitimate admin use of PsExec with documented change ticket
level: high
tags:
- attack.lateral_movement
- attack.t1021.002
WMI Lateral Movement Detection (KQL)
DeviceProcessEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName =~ "wmiprvse.exe"
| where FileName in~ ("cmd.exe", "powershell.exe", "mshta.exe")
| project Timestamp, DeviceName, FileName, ProcessCommandLine,
InitiatingProcessCommandLine
| join kind=inner (
DeviceLogonEvents
| where LogonType == "Network"
| where Timestamp > ago(24h)
) on DeviceName
| project Timestamp, DeviceName, RemoteIP, FileName, ProcessCommandLine
RDP Lateral Movement Detection (SPL)
index=windows (EventCode=4624 Logon_Type=10)
| stats earliest(_time) as first_rdp, latest(_time) as last_rdp,
dc(dest) as dest_count, values(dest) as destinations by src_ip, user
| where dest_count > 2
| eval first_rdp=strftime(first_rdp, "%Y-%m-%d %H:%M:%S")
| sort -dest_count
Network-Based Detection
title: SMB Lateral Movement - Unusual Internal SMB Traffic
id: d4e8f9a1-2c5b-4d7e-8f3a-9b6c1d2e5f4a
status: experimental
description: Detects workstation-to-workstation SMB connections outside baseline
logsource:
category: network_connection
product: windows
detection:
selection:
DestinationPort: 445
Initiated: 'true'
filter_servers:
DestinationIp|cidr:
- '10.0.1.0/24'
condition: selection and not filter_servers
falsepositives:
- Peer-to-peer file sharing in flat networks
level: medium
tags:
- attack.lateral_movement
- attack.t1021.002
Multi-Hop Detection Pattern
// Detect chains: Host A -> Host B -> Host C
DeviceLogonEvents
| where Timestamp > ago(24h)
| where LogonType == "Network"
| project SourceHost = RemoteDeviceName, DestHost = DeviceName,
User = AccountName, T = Timestamp
| join kind=inner (
DeviceLogonEvents
| where LogonType == "Network"
| project SourceHost2 = RemoteDeviceName, DestHost2 = DeviceName,
User2 = AccountName, T2 = Timestamp
) on $left.DestHost == $right.SourceHost2
| where T2 > T and datetime_diff('minute', T2, T) < 30
| where User == User2
| project T, User, Hop1_Src = SourceHost, Hop1_Dest = DestHost,
Hop2_Dest = DestHost2
Workflow
- Baseline — Map normal admin tool usage and approved remote access paths
- Monitor — Deploy detections for each lateral movement technique
- Correlate — Link authentication events to process creation on destination
- Hunt — Search for multi-hop chains and unusual source-destination pairs
- Contain — Isolate compromised hosts via EDR or VLAN reassignment
- Update — Feed findings back into detection rules
Verification
| Check |
Method |
| PsExec detection fires |
Run PsExec in test environment, verify alert |
| WMI detection fires |
wmic /node:target process call create "cmd" triggers alert |
| RDP detection fires |
RDP to test host, verify Type 10 logon captured |
| Network rules active |
Sysmon EID 3 / Zeek conn.log generating for port 445 |
| Multi-hop detection |
Simulate A→B→C chain, verify correlation query results |
References
1---2name: detecting-lateral-movement3description: <!-- Copyright (c) 2026 defconxt. All rights reserved. -->4---5
6<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
7<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
8---
9name: detecting-lateral-movement
10description: >-
11 Detect adversary lateral movement across Windows and Linux environments.
12 Covers PsExec, WMI, RDP, SSH, SMB, WinRM, and DCOM abuse with Sigma rules,
13 KQL/SPL queries, and network-based detection strategies.
14domain: cybersecurity
15subdomain: blue-team
16tags:
17 - lateral-movement
18 - detection-engineering
19 - threat-hunting
20 - mitre-attack
21 - windows
22 - network-security
23version: "1.0"
24author: defconxt
25license: AGPL-3.0
26metadata:
27 mitre-attack: ["T1021.001", "T1021.002", "T1021.003", "T1021.004", "T1021.006", "T1550.002"]
28---
29
30# Detecting Lateral Movement
31
32## Overview
33
34Lateral movement (MITRE ATT&CK Tactic TA0008) allows adversaries to pivot
35through a network after initial access. Detection requires correlating
36authentication events, service creation, network connections, and process
37execution across multiple hosts and log sources.
38
39## Prerequisites
40
41| Requirement | Purpose |
42|---|---|
43| Windows Event Forwarding | Centralized Security/Sysmon logs |
44| Sysmon with EID 1,3,17,18 | Process, network, pipe events |
45| Network flow data | East-west traffic visibility |
46| SIEM with cross-host correlation | Multi-source join capability |
47
48## Key Concepts
49
50### Lateral Movement Techniques
51
52| Technique | ATT&CK ID | Telemetry Sources |
53|---|---|---|
54| PsExec | T1021.002 | EID 7045 (PSEXESVC), EID 4624 Type 3, Sysmon EID 17/18 |
55| WMI | T1021.003 | EID 4624 Type 3, Sysmon EID 1 (wmiprvse child) |
56| RDP | T1021.001 | EID 4624 Type 10, EID 1149 (TerminalServices) |
57| WinRM | T1021.006 | EID 4624 Type 3, EID 91/168 (WinRM Operational) |
58| SSH | T1021.004 | auth.log, sshd accepted/failed entries |
59| DCOM | T1021.003 | Sysmon EID 1 (mmc.exe/dllhost child), network 135 |
60| SMB | T1021.002 | EID 5140/5145 (share access), Sysmon EID 3 port 445 |
61| Pass-the-Hash | T1550.002 | EID 4624 Type 3 + NTLM, LogonProcessName NTLMSSP |
62
63### PsExec Detection (Sigma)
64
65```yaml
66title: PsExec Service Installation
67id: c3f7a8d2-1b4e-4f6a-9d2c-8e7f5a3b6c1d
68status: experimental
69description: Detects PsExec service installation indicating lateral movement
70logsource:
71 product: windows
72 service: system
73detection:
74 selection:
75 EventID: 7045
76 ServiceName|contains:
77 - 'PSEXESVC'
78 - 'psexec'
79 condition: selection
80falsepositives:
81 - Legitimate admin use of PsExec with documented change ticket
82level: high
83tags:
84 - attack.lateral_movement
85 - attack.t1021.002
86```
87
88### WMI Lateral Movement Detection (KQL)
89
90```kql
91DeviceProcessEvents
92| where Timestamp > ago(24h)
93| where InitiatingProcessFileName =~ "wmiprvse.exe"
94| where FileName in~ ("cmd.exe", "powershell.exe", "mshta.exe")
95| project Timestamp, DeviceName, FileName, ProcessCommandLine,
96 InitiatingProcessCommandLine
97| join kind=inner (
98 DeviceLogonEvents
99 | where LogonType == "Network"
100 | where Timestamp > ago(24h)
101) on DeviceName
102| project Timestamp, DeviceName, RemoteIP, FileName, ProcessCommandLine
103```
104
105### RDP Lateral Movement Detection (SPL)
106
107```spl
108index=windows (EventCode=4624 Logon_Type=10)
109| stats earliest(_time) as first_rdp, latest(_time) as last_rdp,
110 dc(dest) as dest_count, values(dest) as destinations by src_ip, user
111| where dest_count > 2
112| eval first_rdp=strftime(first_rdp, "%Y-%m-%d %H:%M:%S")
113| sort -dest_count
114```
115
116### Network-Based Detection
117
118```yaml
119title: SMB Lateral Movement - Unusual Internal SMB Traffic
120id: d4e8f9a1-2c5b-4d7e-8f3a-9b6c1d2e5f4a
121status: experimental
122description: Detects workstation-to-workstation SMB connections outside baseline
123logsource:
124 category: network_connection
125 product: windows
126detection:
127 selection:
128 DestinationPort: 445
129 Initiated: 'true'
130 filter_servers:
131 DestinationIp|cidr:
132 - '10.0.1.0/24'
133 condition: selection and not filter_servers
134falsepositives:
135 - Peer-to-peer file sharing in flat networks
136level: medium
137tags:
138 - attack.lateral_movement
139 - attack.t1021.002
140```
141
142### Multi-Hop Detection Pattern
143
144```kql
145// Detect chains: Host A -> Host B -> Host C
146DeviceLogonEvents
147| where Timestamp > ago(24h)
148| where LogonType == "Network"
149| project SourceHost = RemoteDeviceName, DestHost = DeviceName,
150 User = AccountName, T = Timestamp
151| join kind=inner (
152 DeviceLogonEvents
153 | where LogonType == "Network"
154 | project SourceHost2 = RemoteDeviceName, DestHost2 = DeviceName,
155 User2 = AccountName, T2 = Timestamp
156) on $left.DestHost == $right.SourceHost2
157| where T2 > T and datetime_diff('minute', T2, T) < 30
158| where User == User2
159| project T, User, Hop1_Src = SourceHost, Hop1_Dest = DestHost,
160 Hop2_Dest = DestHost2
161```
162
163## Workflow
164
1651. **Baseline** — Map normal admin tool usage and approved remote access paths
1662. **Monitor** — Deploy detections for each lateral movement technique
1673. **Correlate** — Link authentication events to process creation on destination
1684. **Hunt** — Search for multi-hop chains and unusual source-destination pairs
1695. **Contain** — Isolate compromised hosts via EDR or VLAN reassignment
1706. **Update** — Feed findings back into detection rules
171
172## Verification
173
174| Check | Method |
175|---|---|
176| PsExec detection fires | Run PsExec in test environment, verify alert |
177| WMI detection fires | `wmic /node:target process call create "cmd"` triggers alert |
178| RDP detection fires | RDP to test host, verify Type 10 logon captured |
179| Network rules active | Sysmon EID 3 / Zeek conn.log generating for port 445 |
180| Multi-hop detection | Simulate A→B→C chain, verify correlation query results |
181
182## References
183
184- [MITRE ATT&CK Lateral Movement](https://attack.mitre.org/tactics/TA0008/)
185- [SANS Lateral Movement Detection](https://www.sans.org/white-papers/)
186- [Sigma Lateral Movement Rules](https://github.com/SigmaHQ/sigma/tree/main/rules/windows/builtin/security)