Detection rules › Splunk

Query Registry (PowerShell)

Group by
_time, command_line, host
Source
github.com/anvilogic-forge/armory

Adversaries may interact with the Windows Registry to gather information about the system, configuration, and installed software

MITRE ATT&CK coverage

TacticTechniques
DiscoveryT1012 Query Registry

References

Event coverage

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.

FieldKindValues
EventCodeeq
  • 4103 corpus 105 (splunk 105)
  • 4104 corpus 268 (splunk 268)
c_processlt
  • 20

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.

StageTerm
1TERM
1TERM
1TERM
1reg
1"reg.exe"
1TERM
1query
1"Get-Item"
1TERM
1property
1"Get-ItemProperty"
1"Set-Location"
1"New-Object"
1TERM
1Registry
1TERM
1HKLM
1TERM
1HKCU
1"RegEnumValue"
1"RegQueryInfoKey"
1"RegEnumKeyEx"