Creating a Windows service gives an attacker code execution as SYSTEM that starts before any user logs on. It is also how PsExec-style lateral movement, ransomware deployment and many backdoors execute. Service Control Manager logs every installation as System Event 7045, and the Security log adds Event 4697 where auditing is enabled. Both carry the service name and the exact ImagePath, which is the field to analyse.
Signals at a Glance
| Signal | Where | ATT&CK |
|---|---|---|
| New service installed (7045 System, 4697 Security) | Service Control Manager, Security log | T1543.003 |
| ImagePath contains cmd /c, powershell, %COMSPEC% or a UNC path | 7045 / 4697 ServiceFileName | T1569.002 |
| ImagePath in Temp, AppData, ProgramData or Users\Public | 7045 / 4697 | T1543.003 |
| Service start type changed to auto-start (7040) | System log | T1543.003 |
| Direct write to Services\<name>\ImagePath without sc.exe or SCM | Sysmon 13 | T1112 |
| New kernel driver service from an unsigned or unusual path | Sysmon 6, 7045 ServiceType | T1068 |
Installation Events and ImagePath
The Security log version, Event 4697, is parsed into discrete fields by most SIEM connectors, which makes the ImagePath easy to hunt. Random-looking service names, ImagePaths that wrap a shell, and services pointing at user-writable directories account for most true positives:
// KQL (Sentinel): suspicious service installs from Security 4697
SecurityEvent
| where EventID == 4697
| where ServiceFileName matches regex @"(?i)(\\Temp\\|\\AppData\\|\\ProgramData\\|\\Users\\Public\\|cmd(\.exe)?\s+/c|powershell|%COMSPEC%|\\\\[^\\]+\\)"
or ServiceName matches regex @"^[A-Za-z0-9]{8,16}$"
| project TimeGenerated, Computer, SubjectUserName, ServiceName, ServiceFileName,
ServiceType, ServiceStartType
| order by TimeGenerated desc
// tune/validate: the random-name clause is noisy; keep it only for hosts without management agents.
Event 4697 is not always enabled, so the System log version is the safer base. This Sigma rule covers 7045 and mirrors what most public rule sets look for:
title: Suspicious Service Installed
logsource:
product: windows
service: system
detection:
selection:
Provider_Name: 'Service Control Manager'
EventID: 7045
susp_path:
ImagePath|contains:
- '\Temp\'
- '\AppData\'
- '\ProgramData\'
- '\Users\Public\'
- '\\127.0.0.1\'
- 'cmd.exe /c'
- 'powershell'
condition: selection and susp_path
level: high
# tune/validate: legitimate agents install from ProgramData; baseline before paging on it.
Context That Separates Persistence from Admin Work
- Check the creator. A service installed by an interactive admin during a change window is routine; one installed remotely, seconds after a network logon, matches PsExec-style execution.
- Compare ImagePath against signature and prevalence. An unsigned binary seen on one host that registers as auto-start is the profile of a backdoor.
- Watch the registry path directly with Sysmon 13 on
HKLM\System\CurrentControlSet\Services\*\ImagePath, becausesc.exe configand direct registry edits bypass a 7045 install event. - Treat driver services separately: a new kernel driver on a server, particularly one that is unsigned or appears on a vulnerable-driver blocklist, is a high-priority hunt.
- Look for short-lived services that install, start and delete within seconds. Their persistence value is nil but they are a reliable lateral-movement indicator.
Reference the SigmaHQ service-installation rules, Elastic’s service-creation detections, Splunk ESCU content for T1543.003, MITRE CAR analytics and Atomic Red Team T1543.003 tests. Use Autoruns or osquery’s services table for inventory. Baseline your own environment, because monitoring, backup and EDR products install services regularly.
Build Detections That Fire
Mjolnir Security helps blue teams turn threat intelligence into high-fidelity detections across endpoint, network, identity and cloud telemetry.
- Detection Engineering We build and tune detections mapped to ATT&CK from your own telemetry.
- Threat Hunting as a Service Hypothesis-driven hunts for the behaviours on this page.
- 24/7 Incident Response Containment when a detection fires. Call +1 833 403 5875.
Stay ahead of emerging threats. Get notified when we publish new intelligence reports and advisories.
Subscribe to Alerts