Latest alertCVE-2018-11776 in Apache Struts Confirmed Exploited in the WildRead
Search all news in the platform

Detection rule

Registry Persistence via Service in Safe Mode

HighTest-data validatedSigmaHQ (community)T1564.001

Overview

Detects the modification of the registry to allow a driver or service to persist in Safe Mode.

Rule id
1547e27c-3974-43e2-a7d7-7f484fb928ec
ATT&CK techniques
T1564.001 Hide Artifacts: Hidden Files and Directories
Severity
High
Confidence
Low
Origin
SigmaHQ (community)
SigmaHQ status
test
Used in defense packs
qilin, safepay, rhysida, everest, majinahanashi

Validation

  1. ExperimentalSyntax checked only. Not yet tested on events.
  2. Test-data validatedMatched positive test events and ignored near-miss events. Not yet run in a production SIEM.
  3. SIEM-validatedRun in a real SIEM, with a recorded result.

1 of 1 positive test events matched; 1 of 1 near-miss events were correctly ignored. Community rule reused unmodified from SigmaHQ. OffSet7 converted it and tested it on synthetic events.

Detection logic and queries

Queries are shown exactly as generated. Test them in your environment before you deploy them.

Sigma

Sigma (YAML) · 1547e27c-3974-43e2-a7d7-7f484fb928ec

Download
title: Registry Persistence via Service in Safe Mode
id: 1547e27c-3974-43e2-a7d7-7f484fb928ec
status: test
description: Detects the modification of the registry to allow a driver or service to persist in Safe Mode.
references:
    - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1112/T1112.md#atomic-test-33---windows-add-registry-value-to-load-service-in-safe-mode-without-network
    - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1112/T1112.md#atomic-test-34---windows-add-registry-value-to-load-service-in-safe-mode-with-network
author: frack113
date: 2022-04-04
modified: 2025-10-22
tags:
    - attack.stealth
    - attack.t1564.001
logsource:
    category: registry_set
    product: windows
detection:
    selection:
        TargetObject|contains:
            - '\Control\SafeBoot\Minimal\'
            - '\Control\SafeBoot\Network\'
        TargetObject|endswith: '\(Default)'
        Details: 'Service'
    filter_optional_sophos:
        Image: 'C:\WINDOWS\system32\msiexec.exe'
        TargetObject|endswith:
            - '\Control\SafeBoot\Minimal\SAVService\(Default)'
            - '\Control\SafeBoot\Network\SAVService\(Default)'
    filter_optional_mbamservice:
        Image|endswith: '\MBAMInstallerService.exe'
        TargetObject|endswith: '\MBAMService\(Default)'
        Details: 'Service'
    filter_optional_hexnode:
        Image: 'C:\Hexnode\Hexnode Agent\Current\HexnodeAgent.exe'
        TargetObject|endswith:
            - '\Control\SafeBoot\Minimal\Hexnode Updater\(Default)'
            - '\Control\SafeBoot\Network\Hexnode Updater\(Default)'
            - '\Control\SafeBoot\Minimal\Hexnode Agent\(Default)'
            - '\Control\SafeBoot\Network\Hexnode Agent\(Default)'
        Details: 'Service'
    condition: selection and not 1 of filter_optional_*
falsepositives:
    - Unknown
level: high
regression_tests_path: regression_data/rules/windows/registry/registry_set/registry_set_add_load_service_in_safe_mode/info.yml
simulation:
    - type: atomic-red-team
      name: Windows Add Registry Value to Load Service in Safe Mode without Network
      technique: T1112
      atomic_guid: 1dd59fb3-1cb3-4828-805d-cf80b4c3bbb5
    - type: atomic-red-team
      name: Windows Add Registry Value to Load Service in Safe Mode with Network
      technique: T1112
      atomic_guid: c173c948-65e5-499c-afbe-433722ed5bd4

QRadar CRE

Design for the QRadar Rule Wizard. It is not importable and has not been tested in QRadar.

Rule name
OffSet7: Registry Persistence via Service in Safe Mode
Rule type
Event rule (Local)
Log source types
Microsoft Windows Security Event Log DSM: Sysmon EID 13 (registry value set)

Building blocks

  • BB:OffSet7:Registry Persistence via Service in Safe Mode:selection (match)
    All test lines must match (AND).
    • Process Name / Target Process Name / Object Name contains: \Control\SafeBoot\Minimal\, \Control\SafeBoot\Network\
    • Process Name / Target Process Name / Object Name ends with: \(Default)
    • custom property needed: Details is equal to (case-insensitive): Service
      No QRadar property mapped for "Details": create a custom event property (regex or JSON) on the DSM first.
  • BB:OffSet7:Registry Persistence via Service in Safe Mode:filter_optional_sophos (exclusion)
    All test lines must match (AND).
    • Process Path / Process Name is equal to (case-insensitive): C:\WINDOWS\system32\msiexec.exe
    • Process Name / Target Process Name / Object Name ends with: \Control\SafeBoot\Minimal\SAVService\(Default), \Control\SafeBoot\Network\SAVService\(Default)
  • BB:OffSet7:Registry Persistence via Service in Safe Mode:filter_optional_mbamservice (exclusion)
    All test lines must match (AND).
    • Process Path / Process Name ends with: \MBAMInstallerService.exe
    • Process Name / Target Process Name / Object Name ends with: \MBAMService\(Default)
    • custom property needed: Details is equal to (case-insensitive): Service
      No QRadar property mapped for "Details": create a custom event property (regex or JSON) on the DSM first.
  • BB:OffSet7:Registry Persistence via Service in Safe Mode:filter_optional_hexnode (exclusion)
    All test lines must match (AND).
    • Process Path / Process Name is equal to (case-insensitive): C:\Hexnode\Hexnode Agent\Current\HexnodeAgent.exe
    • Process Name / Target Process Name / Object Name ends with: \Control\SafeBoot\Minimal\Hexnode Updater\(Default), \Control\SafeBoot\Network\Hexnode Updater\(Default), \Control\SafeBoot\Minimal\Hexnode Agent\(Default), \Control\SafeBoot\Network\Hexnode Agent\(Default)
    • custom property needed: Details is equal to (case-insensitive): Service
      No QRadar property mapped for "Details": create a custom event property (regex or JSON) on the DSM first.

Main rule, option A (building blocks)

  1. when the event(s) were detected by one or more of these log source types: Microsoft Windows Security Event Log DSM: Sysmon EID 13 (registry value set)
  2. when an event matches the condition built from these building blocks: BB:OffSet7:Registry Persistence via Service in Safe Mode:selection AND NOT (ANY of [BB:OffSet7:Registry Persistence via Service in Safe Mode:filter_optional_sophos, BB:OffSet7:Registry Persistence via Service in Safe Mode:filter_optional_mbamservice, BB:OffSet7:Registry Persistence via Service in Safe Mode:filter_optional_hexnode])

Main rule, option B (AQL filter test)

Not available: the AQL conversion failed for this rule.

Rule response

  • Severity 7, credibility 6, relevance 7
  • Ensure the detected event is part of an offense; index offense on Log Source (host) and annotate with the rule title and OffSet7 rule id
  • Respond no more than once per 30 minutes per Log Source (tune per environment)

Limitations

  • AQL conversion failed (field 'Details' is not supported); only the building-block design is available.
  • QRadar AQL LIKE / CRE string tests are case-sensitive unless the property is lower-cased; the AQL option uses LOWER() where the backend applied it.

Splunk

Splunk SPLSearch

Search for Splunk with Windows/Sysmon field names. A scheduled search or ES correlation search also needs a schedule, time range, throttling and an adaptive response, set in your environment.

(TargetObject IN ("*\\Control\\SafeBoot\\Minimal\\*", "*\\Control\\SafeBoot\\Network\\*")) TargetObject="*\\(Default)" Details="Service" NOT ((Image="C:\\WINDOWS\\system32\\msiexec.exe" (TargetObject IN ("*\\Control\\SafeBoot\\Minimal\\SAVService\\(Default)", "*\\Control\\SafeBoot\\Network\\SAVService\\(Default)"))) OR (Image="*\\MBAMInstallerService.exe" TargetObject="*\\MBAMService\\(Default)" Details="Service") OR (Image="C:\\Hexnode\\Hexnode Agent\\Current\\HexnodeAgent.exe" (TargetObject IN ("*\\Control\\SafeBoot\\Minimal\\Hexnode Updater\\(Default)", "*\\Control\\SafeBoot\\Network\\Hexnode Updater\\(Default)", "*\\Control\\SafeBoot\\Minimal\\Hexnode Agent\\(Default)", "*\\Control\\SafeBoot\\Network\\Hexnode Agent\\(Default)")) Details="Service"))

Splunk savedsearches.conf stanzaScheduled search template

Template stanza. Review schedule, alert actions and index/sourcetype for your environment before enabling.

[default]
dispatch.earliest_time = -30d
dispatch.latest_time = now

[Registry Persistence via Service in Safe Mode]
description = Detects the modification of the registry to allow a driver or service to persist in Safe Mode.
search = (TargetObject IN ("*\\Control\\SafeBoot\\Minimal\\*", "*\\Control\\SafeBoot\\Network\\*")) TargetObject="*\\(Default)" Details="Service" NOT ((Image="C:\\WINDOWS\\system32\\msiexec.exe" (TargetObject IN ("*\\Control\\SafeBoot\\Minimal\\SAVService\\(Default)", "*\\Control\\SafeBoot\\Network\\SAVService\\(Default)"))) OR (Image="*\\MBAMInstallerService.exe" TargetObject="*\\MBAMService\\(Default)" Details="Service") OR (Image="C:\\Hexnode\\Hexnode Agent\\Current\\HexnodeAgent.exe" (TargetObject IN ("*\\Control\\SafeBoot\\Minimal\\Hexnode Updater\\(Default)", "*\\Control\\SafeBoot\\Network\\Hexnode Updater\\(Default)", "*\\Control\\SafeBoot\\Minimal\\Hexnode Agent\\(Default)", "*\\Control\\SafeBoot\\Network\\Hexnode Agent\\(Default)")) Details="Service"))

Microsoft Sentinel

Microsoft Sentinel KQL (ASIM)Hunting query

Hunting query over ASIM-normalized tables. An analytics rule also needs a schedule, entity mapping and alert grouping.

imRegistry
| where ((RegistryKey contains "\\Control\\SafeBoot\\Minimal\\" or RegistryKey contains "\\Control\\SafeBoot\\Network\\") and RegistryKey endswith "\\(Default)" and RegistryValueData =~ "Service") and (not(((ActingProcessName =~ "C:\\WINDOWS\\system32\\msiexec.exe" and (RegistryKey endswith "\\Control\\SafeBoot\\Minimal\\SAVService\\(Default)" or RegistryKey endswith "\\Control\\SafeBoot\\Network\\SAVService\\(Default)")) or (ActingProcessName endswith "\\MBAMInstallerService.exe" and RegistryKey endswith "\\MBAMService\\(Default)" and RegistryValueData =~ "Service") or (ActingProcessName =~ "C:\\Hexnode\\Hexnode Agent\\Current\\HexnodeAgent.exe" and (RegistryKey endswith "\\Control\\SafeBoot\\Minimal\\Hexnode Updater\\(Default)" or RegistryKey endswith "\\Control\\SafeBoot\\Network\\Hexnode Updater\\(Default)" or RegistryKey endswith "\\Control\\SafeBoot\\Minimal\\Hexnode Agent\\(Default)" or RegistryKey endswith "\\Control\\SafeBoot\\Network\\Hexnode Agent\\(Default)") and RegistryValueData =~ "Service"))))

Defender XDR

Microsoft Defender XDR KQLHunting query

Advanced hunting query. A custom detection rule also needs a frequency, impacted entities and actions.

DeviceRegistryEvents
| where ((RegistryKey contains "\\Control\\SafeBoot\\Minimal\\" or RegistryKey contains "\\Control\\SafeBoot\\Network\\") and RegistryKey endswith "\\(Default)" and RegistryValueData =~ "Service") and (not(((InitiatingProcessFolderPath =~ "C:\\WINDOWS\\system32\\msiexec.exe" and (RegistryKey endswith "\\Control\\SafeBoot\\Minimal\\SAVService\\(Default)" or RegistryKey endswith "\\Control\\SafeBoot\\Network\\SAVService\\(Default)")) or (InitiatingProcessFolderPath endswith "\\MBAMInstallerService.exe" and RegistryKey endswith "\\MBAMService\\(Default)" and RegistryValueData =~ "Service") or (InitiatingProcessFolderPath =~ "C:\\Hexnode\\Hexnode Agent\\Current\\HexnodeAgent.exe" and (RegistryKey endswith "\\Control\\SafeBoot\\Minimal\\Hexnode Updater\\(Default)" or RegistryKey endswith "\\Control\\SafeBoot\\Network\\Hexnode Updater\\(Default)" or RegistryKey endswith "\\Control\\SafeBoot\\Minimal\\Hexnode Agent\\(Default)" or RegistryKey endswith "\\Control\\SafeBoot\\Network\\Hexnode Agent\\(Default)") and RegistryValueData =~ "Service"))))

Elastic

Elastic Lucene (ECS)Hunting query

Lucene query over ECS fields (Winlogbeat/Elastic Agent Windows mappings). A detection rule also needs an index pattern, schedule and actions.

((registry.path:(*\\Control\\SafeBoot\\Minimal\\* OR *\\Control\\SafeBoot\\Network\\*)) AND registry.path:*\\\(Default\) AND registry.data.strings:Service) AND (NOT ((process.executable:C\:\\WINDOWS\\system32\\msiexec.exe AND (registry.path:(*\\Control\\SafeBoot\\Minimal\\SAVService\\\(Default\) OR *\\Control\\SafeBoot\\Network\\SAVService\\\(Default\)))) OR (process.executable:*\\MBAMInstallerService.exe AND registry.path:*\\MBAMService\\\(Default\) AND registry.data.strings:Service) OR (process.executable:"C\:\\Hexnode\\Hexnode Agent\\Current\\HexnodeAgent.exe" AND (registry.path:(*\\Control\\SafeBoot\\Minimal\\Hexnode\ Updater\\\(Default\) OR *\\Control\\SafeBoot\\Network\\Hexnode\ Updater\\\(Default\) OR *\\Control\\SafeBoot\\Minimal\\Hexnode\ Agent\\\(Default\) OR *\\Control\\SafeBoot\\Network\\Hexnode\ Agent\\\(Default\))) AND registry.data.strings:Service)))

Elastic EQL (ECS)Hunting query

EQL query over ECS fields. Usable in an Elastic Security EQL rule after review; index pattern and schedule are set per environment.

any where ((registry.path like~ ("*\\Control\\SafeBoot\\Minimal\\*", "*\\Control\\SafeBoot\\Network\\*")) and registry.path:"*\\(Default)" and registry.data.strings:"Service") and (not ((process.executable:"C:\\WINDOWS\\system32\\msiexec.exe" and (registry.path like~ ("*\\Control\\SafeBoot\\Minimal\\SAVService\\(Default)", "*\\Control\\SafeBoot\\Network\\SAVService\\(Default)"))) or (process.executable:"*\\MBAMInstallerService.exe" and registry.path:"*\\MBAMService\\(Default)" and registry.data.strings:"Service") or (process.executable:"C:\\Hexnode\\Hexnode Agent\\Current\\HexnodeAgent.exe" and (registry.path like~ ("*\\Control\\SafeBoot\\Minimal\\Hexnode Updater\\(Default)", "*\\Control\\SafeBoot\\Network\\Hexnode Updater\\(Default)", "*\\Control\\SafeBoot\\Minimal\\Hexnode Agent\\(Default)", "*\\Control\\SafeBoot\\Network\\Hexnode Agent\\(Default)")) and registry.data.strings:"Service")))

Elastic ES|QL (ECS)Hunting query

ES|QL query over ECS fields; the FROM clause uses * and must be narrowed to your indices.

from * metadata _id, _index, _version | where (registry.path like "*\\\\Control\\\\SafeBoot\\\\Minimal\\\\*" or registry.path like "*\\\\Control\\\\SafeBoot\\\\Network\\\\*") and ends_with(registry.path, "\\(Default)") and registry.data.strings=="Service" and not (process.executable=="C:\\WINDOWS\\system32\\msiexec.exe" and (ends_with(registry.path, "\\Control\\SafeBoot\\Minimal\\SAVService\\(Default)") or ends_with(registry.path, "\\Control\\SafeBoot\\Network\\SAVService\\(Default)")) or ends_with(process.executable, "\\MBAMInstallerService.exe") and ends_with(registry.path, "\\MBAMService\\(Default)") and registry.data.strings=="Service" or process.executable=="C:\\Hexnode\\Hexnode Agent\\Current\\HexnodeAgent.exe" and (ends_with(registry.path, "\\Control\\SafeBoot\\Minimal\\Hexnode Updater\\(Default)") or ends_with(registry.path, "\\Control\\SafeBoot\\Network\\Hexnode Updater\\(Default)") or ends_with(registry.path, "\\Control\\SafeBoot\\Minimal\\Hexnode Agent\\(Default)") or ends_with(registry.path, "\\Control\\SafeBoot\\Network\\Hexnode Agent\\(Default)")) and registry.data.strings=="Service")

No working conversion: IBM QRadar AQL (hunting query) (QRadar AQL backend has no property mapping for field "Details")

Required telemetry

Log source
product: windows · category: registry_set
Fields used
Details Image TargetObject

False positives

  • Unknown

Investigation and response

No OffSet7 investigation guidance has been written for this rule yet. Start from the false positives above and the ATT&CK technique pages.

References

Author and attribution

Author
frack113
Source
SigmaHQ · rules/windows/registry/registry_set/registry_set_add_load_service_in_safe_mode.yml
Upstream commit
9688134317a2
Licence
Detection Rule License (DRL) 1.1

Version history

  1. Version 1Imported from SigmaHQ
  2. OffSet7 build · SigmaHQ 9688134317a2