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

Event coverage

Rule body yaml

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: eval

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

Stage 3: eval

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

Stage 4: eval

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

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

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)

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