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

Detection rule

Dumping of Sensitive Hives Via Reg.EXE

HighTest-data validatedSigmaHQ (community)T1003.002T1003.004T1003.005

Overview

Detects the usage of "reg.exe" in order to dump sensitive registry hives. This includes SAM, SYSTEM and SECURITY hives.

Rule id
fd877b94-9bb5-4191-bb25-d79cbd93c167
ATT&CK techniques
T1003.002 OS Credential Dumping: Security Account Manager, T1003.004 OS Credential Dumping: LSA Secrets, T1003.005 OS Credential Dumping: Cached Domain Credentials
Severity
High
Confidence
Low
Origin
SigmaHQ (community)
SigmaHQ status
test
Used in defense packs
The Gentlemen, Akira, safepay, Play, nightspire

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.

2 of 2 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) · fd877b94-9bb5-4191-bb25-d79cbd93c167

Download
title: Dumping of Sensitive Hives Via Reg.EXE
id: fd877b94-9bb5-4191-bb25-d79cbd93c167
related:
    - id: 038cd51c-3ad8-41c5-ba8f-5d1c92f3cc1e
      type: obsolete
    - id: 4d6c9da1-318b-4edf-bcea-b6c93fa98fd0
      type: obsolete
status: test
description: Detects the usage of "reg.exe" in order to dump sensitive registry hives. This includes SAM, SYSTEM and SECURITY hives.
references:
    - https://www.slideshare.net/heirhabarov/hunting-for-credentials-dumping-in-windows-environment
    - https://eqllib.readthedocs.io/en/latest/analytics/aed95fc6-5e3f-49dc-8b35-06508613f979.html
    - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1003/T1003.md
    - https://www.wietzebeukema.nl/blog/windows-command-line-obfuscation
    - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1003.002/T1003.002.md#atomic-test-1---registry-dump-of-sam-creds-and-secrets
author: Teymur Kheirkhabarov, Endgame, JHasenbusch, Daniil Yugoslavskiy, oscd.community, frack113
date: 2019-10-22
modified: 2026-11-13
tags:
    - attack.credential-access
    - attack.t1003.002
    - attack.t1003.004
    - attack.t1003.005
    - car.2013-07-001
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        - Image|endswith: '\reg.exe'
        - OriginalFileName: 'reg.exe'
    selection_cli_flag:
        CommandLine|contains:
            - ' save '
            - ' export '
            - ' ˢave '
            - ' eˣport '
    selection_cli_hive:
        # The hive must directly follow the HKLM root. A bare '\system' also matches the reg.exe path itself (C:\Windows\System32\reg.exe) and C:\Windows\SystemTemp.
        CommandLine|re|i: '(hk[l˪]m|hkey_[l˪]oca[l˪]_machine)"?\\[sˢ](y[sˢ]tem|am|ecurity)(\\|"|\s|$)'
    condition: all of selection_*
falsepositives:
    - Dumping hives for legitimate purpouse i.e. backup or forensic investigation
level: high
regression_tests_path: regression_data/rules/windows/process_creation/proc_creation_win_reg_dumping_sensitive_hives/info.yml

QRadar AQL

IBM QRadar AQL (hunting query)Hunting query

Hunting search for the Log Activity tab or the API. It is not a QRadar rule.

AQL search for the Log Activity tab or the API. It is NOT a deployable QRadar rule: real-time detection in QRadar is a CRE (Custom Rule Engine) rule, for which this build only writes a design specification (qradar_cre).

SELECT * FROM events WHERE devicetype=12 AND ((LOWER("Process Path") LIKE '%\reg.exe' OR LOWER("Process Name") LIKE '%\reg.exe') OR Filename='reg.exe') AND (LOWER(Command) LIKE '% save %' OR LOWER(Command) LIKE '% export %' OR LOWER(Command) LIKE '% ˢave %' OR LOWER(Command) LIKE '% eˣport %') AND Command MATCHES '(?i)(hk[l˪]m|hkey_[l˪]oca[l˪]_machine)"?\\[sˢ](y[sˢ]tem|am|ecurity)(\\|"|\s|$)'

QRadar CRE

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

Rule name
OffSet7: Dumping of Sensitive Hives Via Reg.EXE
Rule type
Event rule (Local)
Log source types
Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1

Building blocks

  • BB:OffSet7:Dumping of Sensitive Hives Via Reg EXE:selection_img (match)
    Any of the groups matches (OR): build one BB per group and a parent BB "when an event matches any of" them.
    • Process Path / Process Name ends with: \reg.exe
    • Filename is equal to (case-insensitive): reg.exe
  • BB:OffSet7:Dumping of Sensitive Hives Via Reg EXE:selection_cli_flag (match)
    All test lines must match (AND).
    • Command contains: save, export, ˢave, eˣport
  • BB:OffSet7:Dumping of Sensitive Hives Via Reg EXE:selection_cli_hive (match)
    All test lines must match (AND).
    • Command matches the regular expression: (hk[l˪]m|hkey_[l˪]oca[l˪]_machine)"?\\[sˢ](y[sˢ]tem|am|ecurity)(\\|"|\s|$)

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: Security 4688 (with command-line auditing) or Sysmon EID 1
  2. when an event matches the condition built from these building blocks: (ALL of [BB:OffSet7:Dumping of Sensitive Hives Via Reg EXE:selection_img, BB:OffSet7:Dumping of Sensitive Hives Via Reg EXE:selection_cli_flag, BB:OffSet7:Dumping of Sensitive Hives Via Reg EXE:selection_cli_hive])

Main rule, option B (AQL filter test)

  1. when the event matches this AQL filter query: devicetype=12 AND ((LOWER("Process Path") LIKE '%\reg.exe' OR LOWER("Process Name") LIKE '%\reg.exe') OR Filename='reg.exe') AND (LOWER(Command) LIKE '% save %' OR LOWER(Command) LIKE '% export %' OR LOWER(Command) LIKE '% ˢave %' OR LOWER(Command) LIKE '% eˣport %') AND Command MATCHES '(?i)(hk[l˪]m|hkey_[l˪]oca[l˪]_machine)"?\\[sˢ](y[sˢ]tem|am|ecurity)(\\|"|\s|$)'

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

  • 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.
  • Regular expressions (|re) use Java regex in QRadar; verify syntax in the Rule Wizard.

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.

(Image="*\\reg.exe" OR OriginalFileName="reg.exe") (CommandLine IN ("* save *", "* export *", "* ˢave *", "* eˣport *"))
| regex CommandLine="(?i)(hk[l˪]m|hkey_[l˪]oca[l˪]_machine)\"?\\\\[sˢ](y[sˢ]tem|am|ecurity)(\\\\|\"|\\s|$)"

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

[Dumping of Sensitive Hives Via Reg.EXE]
description = Detects the usage of "reg.exe" in order to dump sensitive registry hives. This includes SAM, SYSTEM and SECURITY hives.
search = (Image="*\\reg.exe" OR OriginalFileName="reg.exe") (CommandLine IN ("* save *", "* export *", "* ˢave *", "* eˣport *")) \
| regex CommandLine="(?i)(hk[l˪]m|hkey_[l˪]oca[l˪]_machine)\"?\\\\[sˢ](y[sˢ]tem|am|ecurity)(\\\\|\"|\\s|$)"

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.

imProcessCreate
| where (TargetProcessName endswith "\\reg.exe" or TargetProcessFileOriginalName =~ "reg.exe") and (TargetProcessCommandLine contains " save " or TargetProcessCommandLine contains " export " or TargetProcessCommandLine contains " ˢave " or TargetProcessCommandLine contains " eˣport ") and TargetProcessCommandLine matches regex "(?i)(hk[l˪]m|hkey_[l˪]oca[l˪]_machine)\"?\\\\[sˢ](y[sˢ]tem|am|ecurity)(\\\\|\"|\\s|$)"

Defender XDR

Microsoft Defender XDR KQLHunting query

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

DeviceProcessEvents
| where (FolderPath endswith "\\reg.exe" or ProcessVersionInfoOriginalFileName =~ "reg.exe") and (ProcessCommandLine contains " save " or ProcessCommandLine contains " export " or ProcessCommandLine contains " ˢave " or ProcessCommandLine contains " eˣport ") and ProcessCommandLine matches regex "(?i)(hk[l˪]m|hkey_[l˪]oca[l˪]_machine)\"?\\\\[sˢ](y[sˢ]tem|am|ecurity)(\\\\|\"|\\s|$)"

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.

(process.executable:*\\reg.exe OR process.pe.original_file_name:reg.exe) AND (process.command_line:(*\ save\ * OR *\ export\ * OR *\ ˢave\ * OR *\ eˣport\ *)) AND process.command_line:/.*(([hH][kK][lL˪][mM]|[hH][kK][eE][yY]_[lL˪][oO][cC][aA][lL˪]_[mM][aA][cC][hH][iI][nN][eE])\"?\\[sSˢ]([yY][sSˢ][tT][eE][mM]|[aA][mM]|[eE][cC][uU][rR][iI][tT][yY]))((\\).*|(\").*|(\s).*|())/

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 (process.executable:"*\\reg.exe" or process.pe.original_file_name:"reg.exe") and (process.command_line like~ ("* save *", "* export *", "* ˢave *", "* eˣport *")) and process.command_line regex~ ".*((hk[l˪]m|hkey_[l˪]oca[l˪]_machine)\\\"?\\\\[sˢ](y[sˢ]tem|am|ecurity))((\\\\).*|(\\\").*|(\\s).*|())"

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 (ends_with(process.executable, "\\reg.exe") or process.pe.original_file_name=="reg.exe") and (process.command_line like "* save *" or process.command_line like "* export *" or process.command_line like "* ˢave *" or process.command_line like "* eˣport *") and process.command_line rlike ".*(([hH][kK][lL˪][mM]|[hH][kK][eE][yY]_[lL˪][oO][cC][aA][lL˪]_[mM][aA][cC][hH][iI][nN][eE])\\\"?\\\\[sSˢ]([yY][sSˢ][tT][eE][mM]|[aA][mM]|[eE][cC][uU][rR][iI][tT][yY]))((\\\\).*|(\\\").*|(\\s).*|())"

Required telemetry

Log source
product: windows · category: process_creation
Fields used
CommandLine Image OriginalFileName

False positives

  • Dumping hives for legitimate purpouse i.e. backup or forensic investigation

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
Teymur Kheirkhabarov, Endgame, JHasenbusch, Daniil Yugoslavskiy, oscd.community, frack113
Source
SigmaHQ · rules/windows/process_creation/proc_creation_win_reg_dumping_sensitive_hives.yml
Upstream commit
9688134317a2
Licence
Detection Rule License (DRL) 1.1

Version history

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

Related rules