Detection rules › Sigma
Service Binary in User Controlled Folder
Detects the setting of the "ImagePath" value of a service registry key to a path controlled by a non-administrator user such as "\AppData" or "\ProgramData". Attackers often use such directories for staging purposes. This rule might also trigger on badly written software, where if an attacker controls an auto starting service, they might achieve persistence or privilege escalation. Note that while ProgramData is a user controlled folder, software might apply strict ACLs which makes them only accessible to admin users. Remove such folders via filters if you experience a lot of noise.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Defense Impairment |
Telemetry coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 13: RegistryEvent (Value Set) |
Rule body
title: Service Binary in User Controlled Folder
id: 277dc340-0540-42e7-8efb-5ff460045e07
related:
- id: c625c4c2-515d-407f-8bb6-456f65955669
type: obsolete
status: test
description: |
Detects the setting of the "ImagePath" value of a service registry key to a path controlled by a non-administrator user such as "\AppData\" or "\ProgramData\".
Attackers often use such directories for staging purposes.
This rule might also trigger on badly written software, where if an attacker controls an auto starting service, they might achieve persistence or privilege escalation.
Note that while ProgramData is a user controlled folder, software might apply strict ACLs which makes them only accessible to admin users. Remove such folders via filters if you experience a lot of noise.
references:
- https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1562.001/T1562.001.md
author: Nasreddine Bencherchali (Nextron Systems), Florian Roth (Nextron Systems)
date: 2022-05-02
modified: 2024-03-25
tags:
- attack.persistence
- attack.defense-impairment
- attack.t1112
- detection.threat-hunting
logsource:
category: registry_set
product: windows
detection:
selection:
TargetObject|contains|all:
- 'ControlSet'
- '\Services\'
TargetObject|endswith: '\ImagePath'
Details|contains:
- ':\ProgramData\'
- '\AppData\Local\'
- '\AppData\Roaming\'
filter_optional_zoom:
TargetObject|contains: '\Services\ZoomCptService'
Details|contains: 'C:\Program Files\Common Files\Zoom\Support\CptService.exe'
filter_optional_mbami:
TargetObject|contains: '\Services\MBAMInstallerService'
Details|contains|all:
- 'C:\Users\'
- 'AppData\Local\Temp\MBAMInstallerService.exe'
filter_main_windefend:
TargetObject|contains:
- '\Services\WinDefend\'
- '\Services\MpKs'
Details|contains: 'C:\ProgramData\Microsoft\Windows Defender\'
condition: selection and not 1 of filter_main_* and not 1 of filter_optional_*
falsepositives:
- Unknown
level: medium
Stages and Predicates
Stage 0: condition
selection and not 1 of filter_main_* and not 1 of filter_optional_*Stage 1: selection
selection:
TargetObject|contains|all:
- 'ControlSet'
- '\Services\'
TargetObject|endswith: '\ImagePath'
Details|contains:
- ':\ProgramData\'
- '\AppData\Local\'
- '\AppData\Roaming\'
Stage 2: not filter_main_windefend
filter_main_windefend:
TargetObject|contains:
- '\Services\WinDefend\'
- '\Services\MpKs'
Details|contains: 'C:\ProgramData\Microsoft\Windows Defender\'
Stage 3: not filter_optional_*
filter_optional_zoom:
TargetObject|contains: '\Services\ZoomCptService'
Details|contains: 'C:\Program Files\Common Files\Zoom\Support\CptService.exe'
filter_optional_mbami:
TargetObject|contains: '\Services\MBAMInstallerService'
Details|contains|all:
- 'C:\Users\'
- 'AppData\Local\Temp\MBAMInstallerService.exe'
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
TargetObject | match | \Services\MpKs | excludes:TargetObject field:"TargetObject" value:"\Services\MpKs" |
TargetObject | match | \Services\WinDefend\ | excludes:TargetObject field:"TargetObject" value:"\Services\WinDefend\" |
Details | match | C:\ProgramData\Microsoft\Windows Defender\ | excludes:Details field:"Details" value:"C:\ProgramData\Microsoft\Windows Defender\" |
Details | match | AppData\Local\Temp\MBAMInstallerService.exe | excludes:Details field:"Details" value:"AppData\Local\Temp\MBAMInstallerService.exe" |
Details | match | C:\Users\ | excludes:Details field:"Details" value:"C:\Users\" |
TargetObject | match | \Services\MBAMInstallerService | excludes:TargetObject field:"TargetObject" value:"\Services\MBAMInstallerService" |
Details | match | C:\Program Files\Common Files\Zoom\Support\CptService.exe | excludes:Details field:"Details" value:"C:\Program Files\Common Files\Zoom\Support\CptService.exe" |
TargetObject | match | \Services\ZoomCptService | excludes:TargetObject field:"TargetObject" value:"\Services\ZoomCptService" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Details | match |
| field:"Details" kind:match |
TargetObject | ends_with |
| field:"TargetObject" kind:ends_with value:"\ImagePath" |
TargetObject | match |
| field:"TargetObject" kind:match |