Detection rules › Sigma
Potential Persistence Via Custom Protocol Handler
Detects potential persistence activity via the registering of a new custom protocole handlers. While legitimate applications register protocole handlers often times during installation. And attacker can abuse this by setting a custom handler to be used as a persistence mechanism.
Known false positives
- Many legitimate applications can register a new custom protocol handler. Additional filters needs to applied according to your environment.
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: Potential Persistence Via Custom Protocol Handler
id: fdbf0b9d-0182-4c43-893b-a1eaab92d085
status: test
description: Detects potential persistence activity via the registering of a new custom protocole handlers. While legitimate applications register protocole handlers often times during installation. And attacker can abuse this by setting a custom handler to be used as a persistence mechanism.
references:
- https://ladydebug.com/blog/2019/06/21/custom-protocol-handler-cph/
author: Nasreddine Bencherchali (Nextron Systems)
date: 2022-05-30
modified: 2023-05-12
tags:
- attack.persistence
- attack.defense-impairment
- attack.t1112
logsource:
category: registry_set
product: windows
detection:
selection:
TargetObject|startswith: 'HKCR\'
Details|startswith: 'URL:'
filter_main_ms_trusted:
Details|startswith: 'URL:ms-' # Microsoft Protocols usually start with "ms-"
filter_main_generic_locations:
Image|startswith: # Add more folders to avoid FP
- 'C:\Program Files (x86)'
- 'C:\Program Files\'
- 'C:\Windows\System32\'
- 'C:\Windows\SysWOW64\'
# Uncomment This section to add specific Protocol Handler names that are know
# filter_specific:
# Details: 'URL:'
condition: selection and not 1 of filter_main_*
falsepositives:
- Many legitimate applications can register a new custom protocol handler. Additional filters needs to applied according to your environment.
level: medium
Stages and Predicates
Stage 0: condition
selection and not 1 of filter_main_*Stage 1: selection
selection:
TargetObject|startswith: 'HKCR\'
Details|startswith: 'URL:'
Stage 2: not filter_main_*
filter_main_ms_trusted:
Details|startswith: 'URL:ms-'
filter_main_generic_locations:
Image|startswith:
- 'C:\Program Files (x86)'
- 'C:\Program Files\'
- 'C:\Windows\System32\'
- 'C:\Windows\SysWOW64\'
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
Details | starts_with | URL:ms- | excludes:Details field:"Details" value:"URL:ms-" |
Image | starts_with | C:\Program Files (x86) | excludes:Image field:"Image" value:"C:\Program Files (x86)" |
Image | starts_with | C:\Program Files\ | excludes:Image field:"Image" value:"C:\Program Files\" |
Image | starts_with | C:\Windows\SysWOW64\ | excludes:Image field:"Image" value:"C:\Windows\SysWOW64\" |
Image | starts_with | C:\Windows\System32\ | excludes:Image field:"Image" value:"C:\Windows\System32\" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Details | starts_with |
| field:"Details" kind:starts_with value:"URL:" |
TargetObject | starts_with |
| field:"TargetObject" kind:starts_with value:"HKCR\" |