Service registered with an image path in a user-writable directory
Anchors on the same Security 4697 service-creation record as the published T1569.002 rule, but on a different field pattern, which is what keeps the two from collapsing into one analytic. T1569.002 matches ServiceFileName being a shell, script host or UNC path — the signature of a tool that abuses the service mechanism to execute something once and move on. This rule matches MITRE's ImagePathFilter knob instead, populated here with a broader set of writable-directory paths than MITRE's own worked example: MITRE's mutableElements entry names only `C:\Users\` and `C:\Temp\` directly (the `\Temp\` term below is written to catch that literal path and, as a side effect, `\Windows\Temp\` too); the additional ServiceFileName terms for `\ProgramData\` and the recycle bin are this rule's own extension of that pattern to other locations that are user-writable but atypical for a service image path, regardless of what kind of binary it is — the signature of a service meant to persist, staged somewhere services do not normally live because the adversary has no Program Files-style install path to drop into. A legitimate-looking, correctly-signed executable registered this way still matches; a shell-launching service registered from a normal install path does not, and is exactly what T1569.002 is for instead. The command-line and driver-load legs of AN1527 (`sc.exe`/PowerShell invocation, `.sys` loads via `ZwLoadDriver`) are separate events this rule does not join to the creation record, and MITRE's UnsignedBinaryAlert and ServiceNamePattern knobs need signature status and a name baseline this log source does not carry. 4697 requires the Audit Security System Extension (Success) subcategory, which is off in a default install and in the MS and CIS baselines — without it this rule is blind, not quiet. UNVERIFIED AS AUTHORED — derived from MITRE ATT&CK DET0552, not hand-written and not tested by its author. Any lab result is on this rule's own page.Full descriptionShow less
The detection
The 4 SIEM queries below are previews produced by Siemphony’s own translator, not pySigma, and none has been executed against a real backend — review before you deploy.
detection.yml
Sentinel · KQL
Run this as a search.
SecurityEvent| where (EventID == 4697 and (ServiceFileName contains "\\Users\\" or ServiceFileName contains "\\Temp\\" or ServiceFileName contains "\\ProgramData\\" or ServiceFileName contains "\\$Recycle.Bin\\"))
Splunk · SPL
Run this as a search.
index=* (EventID="4697" AND (ServiceFileName="*\\Users\\*" OR ServiceFileName="*\\Temp\\*" OR ServiceFileName="*\\ProgramData\\*" OR ServiceFileName="*\\$Recycle.Bin\\*"))Elastic · ES|QL
Run this as a search.
FROM logs-*| WHERE (event.code == 4697 AND (TO_LOWER(ServiceFileName) LIKE "*\\\\users\\\\*" OR TO_LOWER(ServiceFileName) LIKE "*\\\\temp\\\\*" OR TO_LOWER(ServiceFileName) LIKE "*\\\\programdata\\\\*" OR TO_LOWER(ServiceFileName) LIKE "*\\\\$recycle.bin\\\\*"))
Wazuh · XML rule
Deploy to your manager — this is a rule, not a search.
<group name="sigma,windows,"> <!-- Rule ids must be unique on your manager; 100000+ is the user range. --> <rule id="100000" level="7"> <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. --> <field name="EventID" type="pcre2">(?i)^4697$</field> <field name="ServiceFileName" type="pcre2">(?i)(\\Users\\|\\Temp\\|\\ProgramData\\|\\\$Recycle\.Bin\\)</field> <description>Service registered with an image path in a user-writable directory</description> <mitre> <id>T1543.003</id> </mitre> </rule></group>
Verdicts · reactions · comments
Community
Verdicts from engineers who actually deployed it, and the conversation around it.
Nobody has run this in a real environment and said what happened.
Verdicts from engineers who deployed it
0 castNo verdicts reported yet. The first one is worth more than the tenth — say what you ran it against.
Log in to report a verdict.
Log in to join the discussion.
No comments yet. Someone who deploys this will have something to say about it.