Skip to content

Lesson 11 of 14 · 16m

Lateral Movement Is Tuesday Admin Work

PsExec, wmiexec, WinRM, and RDP leave parent-child and logon-type shapes that signatures miss and three queries catch.

Lateral movement on a Windows network is mostly legitimate administration performed from the wrong process on the wrong host. There is rarely malware to find — the adversary is running the same protocols your admins run, with credentials that authenticate cleanly. The tells are shapes: parent-child relationships, write-then-execute sequences, and logon types that don't match the story.

The four workhorse chains

PsExec and its clones. psexec.exe writes a service binary to \\TARGET\ADMIN$ — Sysmon 11 records C:\Windows\PSEXESVC.exe — then installs it as a service, so System log 7045 records a service install and the remote commands run as children of PSEXESVC.exe. Named-pipe Sysmon 17/18 events show \pipe\PSEXESVC. -r renames the service, so hunt the shape — service binary written to ADMIN$ then installed — not the name.

wmiexec / smbexec (Impacket). No service at all: the operator calls Win32_Process.Create over DCOM/WMI, and the remote command lands as cmd.exe spawned by WmiPrvSE.exe. Output is staged to \\127.0.0.1\ADMIN$\__<epoch> — watch for that filename pattern — then read back over SMB. WmiPrvSE.exe spawning cmd.exe is a one-line hunt with a spectacular true-positive rate.

WinRM / PSRemoting. TCP 5985 (HTTP) or 5986 (HTTPS) inbound, wsmprovhost.exe as the process actually running the remote commands, Microsoft-Windows-WinRM/Operational event 91 on session creation, and 4104 script-block logs holding whatever ran — deobfuscated. wsmprovhost.exe with child processes is the same shape test as WmiPrvSE.exe.

RDP. Security 4624 logon type 10 (RemoteInteractive; type 7 is unlock — different story), TerminalServices-LocalSessionManager/Operational events 21/23/25 for connect/disconnect/reconnect, and mstsc.exe on the source. An RDP logon from a workstation that never administers anything is the tell, not RDP itself.

SSH on Linux mirrors all of this: Accepted publickey/Accepted password in auth.log, unexpected keys appearing in authorized_keys — including command= forced-command options that turn a key into a launcher — and long-held ssh -R/-D tunnels showing as inbound connections that never close.

The credential layer

Logon types tell the credential story the process events can't. Type 9 NewCredentials means runas /netonly or injected credentials — the classic shape when tooling touches a host it never interactively logged onto. 4648 records the explicit-credential attempt. On the DC, 4776 NTLM validations mapping workstation→server pairs that have no business authenticating to each other is pass-the-hash territory; 4768+4769 service tickets without a preceding interactive logon is overpass-the-hash or a stolen TGT doing the work.

The shape test

Every lateral technique collapses to the same three questions: what process is doing it (is this parent supposed to spawn shells?), where is it coming from (is this source host an admin box?), when (change window or 03:00?). psexec.exe run by your deployment account from the SCCM server during the maintenance window is administration. The same PSEXESVC service appearing on a finance laptop at 2 a.m. from a workstation with no admin role is the hunt. The protocol is identical; the shape is the entire difference, which is why signature tools miss it and analysts with three queries catch it.

Proof and practice

NotPetya spread through enterprise networks in minutes on June 27, 2017 using EternalBlue plus WMIC and PsExec carrying credentials scraped from memory — nothing in the chain was exotic. Every element lived on somebody's allowlist except the shape, which is the entire argument for hunting shapes instead of names.

Four standing hunts earn their keep permanently: WmiPrvSE.exe or wsmprovhost.exe spawning children; 7045 service installs whose binary lives outside Program Files; type-9 logons grouped by source; and ADMIN$ writes followed by service creation. Run them weekly and lateral movement stops being invisible by construction.

One caveat on the ADMIN$ evidence: Impacket's wmiexec writes to ADMIN$\__<epoch> on the target's own share via the loopback path — Sysmon 11 sees the file create locally, so the hunt is the filename pattern ADMIN$\__* plus the WmiPrvSE.exe parentage, not an SMB write from a foreign source. Know which side of the wire your telemetry watches.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.