Detection rules › Splunk
Potential Target Discovery via PowerShell Event Log Queries (PowerShell)
Threat actors may use custom scripts during discovery activities to identify targets on a network. This use case detects PowerShell scripts querying System, Security, and Windows Terminal Services event logs as observed with RagnarLocker
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Discovery | T1082 System Information Discovery |
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: '19995.35576'
title: Potential Target Discovery via PowerShell Event Log Queries
description: 'Threat actors may use custom scripts during discovery activities to
identify targets on a network. This use case detects PowerShell scripts querying
System, Security, and Windows Terminal Services event logs as observed with RagnarLocker.
-- Threat Actor Association: APT28 (aka.Fancy Bear, Fighting Ursa, Forest Blizzard,
Pawn Storm, TA422, STRONTIUM) - Software Association: RagnarLocker'
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_powershell` (TERM(EventCode=4103) OR
"<EventID>4103<" TERM(EventCode=4104) OR "<EventID>4104<") (TERM(Get-EventLog) OR
TERM(Get-WinEvent)) ("7001" OR "7002" OR "21" OR "25" OR "4624") | table _time,
host, user process, process_*, signature_id | bin span=1s | stats values(*) as *
by _time, host '
techniques:
- discovery:system information discovery
technique_id:
- T1082
data_category:
- PowerShell logs
references:
- https://blog.sygnia.co/threat-actor-spotlight-ragnarlocker-ransomware?_ga=2.100185502.1673284611.1684933734-1923873697.1682517767
- https://thedfirreport.com/2023/10/30/netsupport-intrusion-results-in-domain-compromise/
Stages and Predicates
Stage 1: search
`get_endpoint_data` `get_endpoint_data_powershell` (TERM(EventCode=4103) OR "<EventID>4103<" TERM(EventCode=4104) OR "<EventID>4104<") (TERM(Get-EventLog) OR TERM(Get-WinEvent)) ("7001" OR "7002" OR "21" OR "25" OR "4624")
Stage 2: table
| table _time, host, user process, process_*, signature_id
Stage 3: bucket
| bin span=1s
Stage 4: stats
| stats values(*) as * by _time, host
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.
| Field | Kind | Values |
|---|---|---|
EventCode | eq |
|
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 | "<EventID>4103<" |
| 1 | TERM |
| 1 | "<EventID>4104<" |
| 1 | "Get-EventLog" |
| 1 | "Get-WinEvent" |
| 1 | "7001" |
| 1 | "7002" |
| 1 | "21" |
| 1 | "25" |
| 1 | "4624" |