Lateral Movement via SMB and PsExec-Style Remote Execution
SMB-based lateral movement using PsExec, PAExec, or RemCom is the dominant lateral movement technique in ransomware deployments by Akira, Black Basta, and LockBit affiliates. The attacker gains initial credentials (via spray, phishing, or VPN compromise), then uses remote execution tools to install and run payloads on other hosts across the domain — typically targeting domain controllers first for maximum impact. Key behavioural indicators: (1) PsExec binary appearing in user temp directories rather than System32 (attackers drop it from a C2 payload); (2) PSEXESVC service being created on remote hosts — the server-side component of PsExec; (3) Admin share (ADMIN$) access used to copy the execution wrapper; (4) Use of Windows Management Instrumentation (WMI) or WinRM as alternatives when PsExec is blocked. NCSC has observed Akira affiliates using this exact pattern against UK SMBs since 2023.
// THREAT: Lateral Movement via SMB/PsExec-Style Remote Execution
// Detects PsExec, PAExec, PSEXESVC service creation, and Admin share lateral movement
// Alert 1: PsExec/PAExec execution from non-standard locations
let LegitPsExecPaths = dynamic(["C:\\Tools\\", "C:\\Sysinternals\\", "C:\\Program Files\\Sysinternals"]);
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("psexec.exe", "psexec64.exe", "paexec.exe", "remcom.exe", "csexec.exe")
| where not(FolderPath has_any (LegitPsExecPaths))
| extend SuspiciousLocation = FolderPath has_any (
"C:\\Users\\", "C:\\Windows\\Temp\\", "C:\\ProgramData\\",
"AppData\\", "C:\\Temp\\", "C:\\Public\\"
)
| project Timestamp, DeviceName, AccountName, FileName, FolderPath,
ProcessCommandLine, InitiatingProcessFileName, SuspiciousLocation
| extend ThreatType = "LateralMovement_PsExec_SuspiciousPath"
| extend StagingRisk = 85;
// Alert 2: PSEXESVC service creation (server-side PsExec indicator)
DeviceServiceEvents
| where Timestamp > ago(24h)
| where ServiceName in~ ("PSEXESVC", "paexec", "remcom")
| project Timestamp, DeviceName, AccountName, ServiceName, ServiceState,
InitiatingProcessFileName, InitiatingProcessCommandLine
| extend ThreatType = "LateralMovement_PSEXESVC_RemoteService"
| extend StagingRisk = 90;
// Alert 3: Admin share access from internal hosts (staging/lateral movement)
DeviceNetworkEvents
| where Timestamp > ago(24h)
| where RemotePort in (445, 139)
| where ActionType =~ "ConnectionSuccess"
| where RemoteIPType =~ "Private"
// Exclude expected domain controller replication and group policy traffic
| where InitiatingProcessFileName !in~ ("svchost.exe", "lsass.exe", "system")
| summarize
Connections=count(),
TargetHosts=dcount(RemoteIP),
TargetIPs=make_set(RemoteIP)
by DeviceName, AccountName, InitiatingProcessFileName, bin(Timestamp, 15m)
| where Connections >= 5 or TargetHosts >= 3
| extend ThreatType = "LateralMovement_AdminShare_BulkAccess"
| extend StagingRisk = 75 Data Sources
Required Tables
False Positives
- Authorised IT administrators using PsExec from Sysinternals for remote administration from approved management workstations
- Software deployment tools (SCCM, Ansible, Puppet) that use WMI or SMB for mass package deployment
- Domain join and Group Policy application traffic over SMB (exclude SYSTEM and svchost.exe as initiators)
- Enterprise backup agents (Veeam, Backup Exec) that access admin shares during backup jobs
References (5)
- https://www.ncsc.gov.uk/collection/ransomware/lateral-movement
- https://www.cisa.gov/stopransomware/akira-ransomware
- https://docs.microsoft.com/en-us/sysinternals/downloads/psexec
- https://attack.mitre.org/techniques/T1021/002/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1021.002/T1021.002.md
Unlock Pro Content
Get the full detection package for THREAT-LateralMovement-SMBPsExec including response playbook, investigation guide, and atomic red team tests.