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
Discovery

References

Telemetry coverage

Rule body

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

These rows show field, operator, and value matches.

FieldKindValuesSearch
EventCodeeq
  • 4103 corpus 105 (splunk 105)
  • 4104 corpus 269 (splunk 269)
field:"EventID" kind:eq
c_processlt
  • 20
field:"c_process" kind:lt value:"20"

Search terms

These SPL tokens match against raw event text.

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