PowerShell Credential Discovery via Recursive File Search and Select-String

Flags PowerShell script blocks that recursively list files and run select-string pattern searches, indicative of credential hunting.

FreeReviewedSigma · Medium · v2
Product
windows
Category
ps_script
Author
frack113 (SigmaHQ), DRL 1.1
Published
2021-12-19
Updated
2026-07-31

ATT&CK techniques

Cred Access
  1. Recon

  2. Resource Dev

  3. Initial Access

  4. Execution

  5. Persistence

  6. Priv Esc

  7. Defense Evasion

  8. Discovery

  9. Lateral Movement

  10. Collection

  11. C2

  12. Exfiltration

  13. Impact

What it detects

This rule flags PowerShell script block activity that combines a recursive directory listing with pattern searching using select-string, consistent with discovering files that may contain sensitive data. Attackers often use this to locate locally stored or shared files holding credentials, configuration secrets, or other embedded sensitive strings. It relies on Windows PowerShell script block text telemetry, specifically Script Block Logging, to observe the presence of the involved cmdlet and parameters.

Related detections9 linkedT1552.001 — drag to rearrange
Malicious Marimo Notebook Credential File Access via Shell (via process_creation)
Malicious Keyhunter Worker Persistence via Systemd Service
Suspicious TruffleHog Execution Spawned by Bun Runtime via Process Creation
Malicious AWS Credential Exfiltration via Curl or Wget in Process Creation
Suspicious sqlite3 Access to gcloud Cached Access Token Database (via process_creation)
Suspicious AWS GetCallerIdentity From TruffleHog User Agent via Cloudtrail
Suspicious GitHub CLI Auth Token Extraction via Command Line
Suspicious Access to macOS Login Keychain by Slow Pisces (via process_creation)
Suspicious mdfind Search for Private Key Files on macOS (via process_creation)
PowerShell Credential Discovery via Recursive File Search and Select-String
Pivot detection · T1552.001 · 9 related

Changelog

v2
  1. v2
    Candidate ingested via manual entry.2026-07-31
  2. v1
    No changelog recorded for this version.2026-07-30

Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.