Detection rules › Splunk

Locate Credentials (PowerShell)

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

Adversaries may search local file systems and remote file shares for files containing passwords. These can be files created by users to store their own credentials, shared credential stores for a group of individuals, configuration files containing passwords for a system or service, or source code/binary files containing embedded passwords

MITRE ATT&CK coverage

References

Telemetry coverage

Rule body

id: '1081.1131'
title: Locate Credentials
description: 'Adversaries may search local file systems and remote file shares for
  files containing passwords. These can be files created by users to store their own
  credentials, shared credential stores for a group of individuals, configuration
  files containing passwords for a system or service, or source code/binary files
  containing embedded passwords. -- Threat Actor Association: Alloy Taurus/Gallium,
  Antlion, APT15, APT29/Nobelium/Cozy Bear, DarkSide, BlackMatter, Lancyfly, Lapsus$,
  TeamTNT, Wizard Spider - Software Association: ALPHV/BlackCat, Conti, Ransom Cartel,
  Snake, TeamTNT -- Atomics 1003.002 Test #5 NOTE *Only for the Powershell version
  Atomics T1552.001 Test#1 Atomics T1552.001 Test#3 Atomics T1552.006 Test#1 Atomics
  T1552.004 Test#2'
logic_format: Splunk
logic: ' `get_endpoint_data` `get_endpoint_data_powershell` (TERM(EventCode=4103)
  OR TERM(EventCode=4104)) AND (TERM(findstr) AND (TERM(password) OR TERM(txt) OR
  TERM(ini) OR TERM(xml) OR TERM(pass) OR TERM(cred) OR TERM(vnc) OR TERM(config)
  OR TERM(spin) )) OR (TERM(type) AND (TERM(sysprep) OR TERM(unattend) OR TERM(Unattended))
  AND (TERM(inf) OR TERM(ini) OR TERM(xml))) OR (TERM(dir) AND (TERM(vnc) OR TERM(ultravnc))
  AND (TERM(inf) OR TERM(ini) OR TERM(xml))) OR (("cmd.exe" AND TERM(/c) AND TERM(copy))
  AND ("ntds.dit" OR "SAM" OR "System" )) OR (TERM(vssadmin) AND TERM(create) AND
  TERM(SHADOW)) OR ("ntdsutil") OR ("wmic" TERM(shadowcopy)) OR (("gwmi" OR "get-wmiobject")
  "shadowcopy") | rex field=process "(?<script>(?i)\w+.ps1") | rex field=process mode=sed
  max_match=0 "s/(?mi)^(Path.+)|^(ScriptBlock ID.+)|^(Creating Scriptblock.+)//g"
  | rex field=process mode=sed "s/([\n\r]+)|(\s\s+)//g" | table _time, host, user,
  process, process_*, script | bin span=300s | stats values(*) as * by _time, host '
techniques:
- credential-access:unsecured credentials:credentials in files
technique_id:
- T1552.001
data_category:
- PowerShell logs
- Process command-line parameters
references:
- https://attack.mitre.org/techniques/T1552/001/

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_powershell` (TERM(EventCode=4103) OR TERM(EventCode=4104)) AND (TERM(findstr) AND (TERM(password) OR TERM(txt) OR TERM(ini) OR TERM(xml) OR TERM(pass) OR TERM(cred) OR TERM(vnc) OR TERM(config) OR TERM(spin) )) OR (TERM(type) AND (TERM(sysprep) OR TERM(unattend) OR TERM(Unattended)) AND (TERM(inf) OR TERM(ini) OR TERM(xml))) OR (TERM(dir) AND (TERM(vnc) OR TERM(ultravnc)) AND (TERM(inf) OR TERM(ini) OR TERM(xml))) OR (("cmd.exe" AND TERM(/c) AND TERM(copy)) AND ("ntds.dit" OR "SAM" OR "System" )) OR (TERM(vssadmin) AND TERM(create) AND TERM(SHADOW)) OR ("ntdsutil") OR ("wmic" TERM(shadowcopy)) OR (("gwmi" OR "get-wmiobject") "shadowcopy")

Stage 2: rex

| rex field=process "(?<script>(?i)\w+.ps1")

The parser skipped this rex command.

Stage 3: rex

| rex field=process mode=sed max_match=0 "s/(?mi)^(Path.+)|^(ScriptBlock ID.+)|^(Creating Scriptblock.+)//g"

The parser skipped this rex command.

Stage 4: rex

| rex field=process mode=sed "s/([\n\r]+)|(\s\s+)//g"

The parser skipped this rex command.

Stage 5: table

| table _time, host, user, process, process_*, script

Stage 6: bucket

| bin span=300s

Stage 7: stats

| stats values(*) as * by _time, host

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

Search terms

These SPL tokens match against raw event text.

StageTerm
1findstr
1password
1txt
1ini
1xml
1pass
1cred
1vnc
1config
1spin
1type
1sysprep
1unattend
1Unattended
1inf
1ini
1xml
1dir
1vnc
1ultravnc
1inf
1ini
1xml
1"cmd.exe"
1"/c"
1copy
1"ntds.dit"
1"SAM"
1"System"
1vssadmin
1create
1SHADOW
1"ntdsutil"
1"wmic"
1shadowcopy
1"gwmi"
1"get-wmiobject"
1"shadowcopy"