Remote Service Execution via WMI and PowerShell
Windows Management Instrumentation (MITRE T1047) lets an admin — or an attacker holding admin credentials — execute commands on remote hosts with no agent, no file upload to an admin share, and no new listening service: everything rides over the WMI/DCOM infrastructure that already exists for management. The cleanest code-execution path through it is creating a temporary Windows service via Win32_Service.Create, starting it, then deleting it — a pattern that doubles as MITRE T1543.003 (Create or Modify System Process: Windows Service).
Why WMI for lateral movement
- Built-in and expected: WMI traffic is ordinary admin behavior in most environments, so it blends in where PsExec-style admin-share writes stand out.
- No disk footprint required: the service
PathNamecan be acmd /c ...or PowerShell one-liner that pulls a payload from memory — the only artifact is the service registration itself. - Runs as SYSTEM: services created this way execute in the LocalSystem context by default.
- Dual ATT&CK coverage: the transport is T1047 (WMI); the mechanism is T1543.003 (service creation) — detections need to catch either half.
The pattern
# Create the service remotely over an established CIM session
Invoke-CimMethod -CimSession $Session -ClassName Win32_Service -MethodName Create -Arguments @{
Name = $ServiceName
DisplayName = $ServiceName
PathName = $Command # e.g. "cmd /c powershell -enc ..."
ServiceType = [byte]16 # 16 = Win32OwnProcess
StartMode = "Manual"
}
# Handle → start → verify stopped → delete (clean up after yourself)
$svc = Get-CimInstance -CimSession $Session -ClassName Win32_Service `
-Filter "Name LIKE '$ServiceName'"
Invoke-CimMethod -InputObject $svc -MethodName StartService
Invoke-CimMethod -InputObject $svc -MethodName StopService
Invoke-CimMethod -InputObject $svc -MethodName DeleteNotes:
Invoke-CimMethoduses WS-Man (CIM) sessions rather than legacy DCOMInvoke-WmiMethod; both reach the sameWin32_Serviceprovider. See windows-services for why the payload itself usually isn’t a service binary — a normal EXE asPathNamedies quickly and logs a failure, which is fine for a one-shot command but wrong for a persistent listener.- The create/start/delete lifecycle completes in seconds, but every step writes to the event log — ephemeral is not invisible.
Detection
This technique has excellent native telemetry:
- Security EID 4697 / System EID 7045 — service installation events; new services with random names,
cmd /cor PowerShell in the binPath, orLocalSystemaccounts are near-perfect indicators - EID 7035/7036 — service start/stop shortly after creation (the ephemeral-service heartbeat)
- WMI activity:
WmiPrvSE.exespawningcmd.exe/powershell.exeon the target, plus Sysmon EID 1 command lines containingWin32_Service/Create - CISA advisories have documented SVR and PRC state actors using exactly this pattern for lateral movement, so mature SOCs treat
wmiprvse → shellprocess trees as high-severity by default
Sources
- Windows Management Instrumentation — MITRE ATT&CK T1047
- MITRE ATT&CK — T1543.003 Create or Modify System Process: Windows Service
- Create method of the Win32_Service class (CIMWin32 WMI Providers) — Microsoft Learn
- Invoke-CimMethod — Microsoft Learn
Related
- windows-services — what services are, how their config/DACLs live in the registry, and why driver binPaths are a kernel-load primitive
- wmi-powershell-sessions — building the CIM/DCOM session this page’s
Invoke-CimMethodcalls ride on - invoke-cimmethod-remote-command — the lighter sibling primitive:
Win32_Process.Createfor one-shot command execution without a service - wmic — the deprecated CLI predecessor for the same WMI exec primitive
- wmi-remote-scheduled-task — the scheduled-task variant of this primitive over the same CIM session
- attack-ms-sql-server-powerupsql — the other remote-command-execution channel in a Windows estate (xp_cmdshell over linked servers)
- netstat — confirming the service actually produced the expected listener/connection
- remote-msi-install-powershell — the parallel WMI primitive:
Win32_Product.Installfor fileless lateral movement via MSI packages