Detection rules › Splunk
Query Registry (PowerShell)
Adversaries may interact with the Windows Registry to gather information about the system, configuration, and installed software
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Discovery | T1012 Query Registry |
References
Event coverage
| Provider | Event | Title |
|---|---|---|
| PowerShell | Event ID 4103 | Payload Context: ContextInfo User Data: UserData. |
| PowerShell | Event ID 4104 | Creating Scriptblock text (MessageNumber of MessageTotal). |
Rule body yaml
id: '6138.6633'
title: Query Registry
description: 'Adversaries may interact with the Windows Registry to gather information
about the system, configuration, and installed software. -- Threat Actor Association:
APT29/Nobelium/Cozy Bear, APT33, APT37, Carbanak, GoldenJackal, Lazarus, SaintBear
(aka UAC-0056, UNC2589, TA471), TA505, Wizard Spider, WIRTE - - Software Associations:
Bazar, Conti, Dridex, Emotet, NanoCore, PowerShortShell, Snatch, SquirrelWaffle,
Ursnif, Zloader -- Atomics T1012 Test#1 Atomics T1218 Test#4 Atomics T1547.005 Test#1
-- #TrendingThreat #Russia #Ukraine'
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_powershell` (TERM(EventCode=4103) OR
TERM(EventCode=4104)) (((TERM(reg) OR "reg.exe") TERM(query)) OR ((("Get-Item" TERM(property))
OR "Get-ItemProperty" OR "Set-Location" OR "New-Object") (TERM(Registry) OR TERM(HKLM)
OR TERM(HKCU))) OR ( "RegEnumValue" OR "RegQueryInfoKey" OR "RegEnumKeyEx")) | table
_time, host, user, signature_id, process_name, user, process | bin span=1s | stats
values(*) as * by _time, host | eventstats c(process) as c_process by process| where
c_process < 20 '
techniques:
- discovery:query registry
technique_id:
- T1012
data_category:
- PowerShell logs
- Process command-line parameters
references:
- https://securelist.com/the-epic-turla-operation/65545/
- https://www.welivesecurity.com/wp-content/uploads/2016/10/eset-sednit-part-2.pdf
Stages and Predicates
Stage 1: search
`get_endpoint_data` `get_endpoint_data_powershell` (TERM(EventCode=4103) OR TERM(EventCode=4104)) (((TERM(reg) OR "reg.exe") TERM(query)) OR ((("Get-Item" TERM(property)) OR "Get-ItemProperty" OR "Set-Location" OR "New-Object") (TERM(Registry) OR TERM(HKLM) OR TERM(HKCU))) OR ( "RegEnumValue" OR "RegQueryInfoKey" OR "RegEnumKeyEx"))
Stage 2: table
| table _time, host, user, signature_id, process_name, user, process
Stage 3: bucket
| bin span=1s
Stage 4: stats
| stats values(*) as * by _time, host
Stage 5: eventstats
| eventstats c(process) as c_process by process
Stage 6: where
| where c_process < 20
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
Search terms
Bare-string tokens in the SPL search body. Splunk matches each token against _raw (the untyped raw event text) anywhere it appears, not against a specific field. These don't surface in the Indicators table because they aren't predicates on a known field.
| Stage | Term |
|---|---|
| 1 | TERM |
| 1 | TERM |
| 1 | TERM |
| 1 | reg |
| 1 | "reg.exe" |
| 1 | TERM |
| 1 | query |
| 1 | "Get-Item" |
| 1 | TERM |
| 1 | property |
| 1 | "Get-ItemProperty" |
| 1 | "Set-Location" |
| 1 | "New-Object" |
| 1 | TERM |
| 1 | Registry |
| 1 | TERM |
| 1 | HKLM |
| 1 | TERM |
| 1 | HKCU |
| 1 | "RegEnumValue" |
| 1 | "RegQueryInfoKey" |
| 1 | "RegEnumKeyEx" |