Persistence through an automatically starting service.
What gives it awayA service pointing at a binary outside normal software directories with an automatic start type.
ATT&CK T1543.003Nothing matches that yet. Tell us what you were looking for and it goes on the list.
Windows System Log · Event 7045
A service was registered with Windows. It is available by default with no audit policy to configure, which makes it one of the most practical persistence signals you can collect — and remote execution tools give themselves away here constantly.
Also written as Event ID 7045Service Control Manager 7045New service installedservice was installed 7045
A program registered a background component that will start with Windows. Expected right after installing software. Worth questioning if you have not installed anything.
Collect this everywhere. Unlike Security event 4697 it needs no audit policy, so it works on machines nobody configured. The trade-off is that it does not record which account performed the installation — collect 4697 as well where you can. The service file name is the field that carries the signal.
Sanitised. Addresses come from the RFC 5737 documentation ranges.
A service was installed in the system.
Service Name: WinHelpSvc
Service File Name: C:\Users\jbrooks\AppData\Local\Temp\wh.exe
Service Type: user mode service
Service Start Type: auto start
Service Account: LocalSystem Everything else in the log line is context.
A path under Program Files or System32Where legitimate services live. A path under a temp directory or user profileServices do not normally live here. cmd.exe or powershell.exe with argumentsA service that exists only to run a command. This is how several remote execution tools operate. A path containing an encoded or base64 stringAlmost never legitimate. An unquoted path containing spacesA privilege escalation weakness regardless of intent. Most of the time it is one of these.
What gives it awayA service pointing at a binary outside normal software directories with an automatic start type.
ATT&CK T1543.003What gives it awayA short-lived service whose file name is a command interpreter with arguments, often with a randomly generated service name.
ATT&CK T1569.002What gives it awayA kernel driver service registered outside a driver installation, particularly one that is signed but known to be vulnerable.
ATT&CK T1547.006What gives it awayA service name close to a genuine Windows service but with a path that does not match where the real one lives.
ATT&CK T1036.005Event | where EventLog == 'System' and EventID == 7045 | extend Path = extract(@'Service File Name:\s*(.+)', 1, RenderedDescription) | where Path has_any ('\\Temp\\','\\Users\\','\\AppData\\','cmd.exe','powershell.exe','%COMSPEC%') | project TimeGenerated, Computer, RenderedDescription Event | where EventLog == 'System' and EventID == 7045 | extend Name = extract(@'Service Name:\s*(.+)', 1, RenderedDescription) | summarize hosts = dcount(Computer), first = min(TimeGenerated) by Name | where hosts <= 2 | order by first desc Get-WinEvent -FilterHashtable @{LogName='System'; Id=7045; StartTime=(Get-Date).AddDays(-30)} | Select-Object TimeCreated, Message | Format-List detection:
selection:
EventID: 7045
ServiceFileName|contains:
- '\\Temp\\'
- '\\AppData\\'
- 'cmd.exe /c'
- 'powershell'
condition: selection Not by itself — every ordinary software installation produces one. What makes it suspicious is the service file name. Legitimate services run binaries from Program Files, System32, or a vendor directory; a service pointing at a temp folder, a user profile, or a command interpreter is not a normal installation regardless of what it calls itself.
They record the same event from different logs. 7045 is in the System log and is available by default on every Windows machine. 4697 is in the Security log, requires the Audit Security System Extension subcategory to be enabled, and additionally records which account performed the installation. Collect 7045 for coverage and 4697 for attribution.
Because that is genuinely how they work. Tools that run commands on a remote machine typically copy a small executable to the admin share, register it as a service, start it, and remove it afterwards. Legitimate administration and attacker lateral movement produce almost identical events, which is why the service name and path matter more than the technique.
As far as your System log retention allows, which by default is a rolling size limit rather than a time limit — often only a few weeks on a busy machine. If you care about service installations historically, forward them off the host, because the local log will roll over long before you need it.
Last reviewed 28 August 2026