Skip to content
Threat Feed
medium advisory

PowerShell Sensitive File Discovery Technique

Adversaries utilize PowerShell commands to recursively search for sensitive file extensions such as .pass and .kdbx to identify credentials or keys stored on disk.

This technique involves the use of PowerShell cmdlets to perform recursive directory searches specifically targeting sensitive file extensions associated with password managers and credential stores. Adversaries often execute these commands post-compromise to locate, exfiltrate, or harvest credentials necessary for privilege escalation or lateral movement. By leveraging cmdlets such as Get-ChildItem with recursion enabled, attackers can efficiently identify high-value targets across diverse directory structures on a compromised Windows host. Detection of this activity relies on monitoring PowerShell Script Block Logging, as these commands are frequently executed within volatile memory or via one-liners that bypass traditional file-system logging.

Attack Chain

  1. Initial access is established through spearphishing or exploit delivery on the target system.
  2. The attacker gains execution of a PowerShell instance or interactive shell.
  3. The attacker identifies the current user context and file system structure.
  4. The attacker executes a recursive search command (e.g., Get-ChildItem -Recurse) targeting specific patterns like ".kdbx" or ".pass".
  5. The search identifies the absolute path to credential-related files on the disk.
  6. The attacker reads or exfiltrates the discovered sensitive files to a C2-controlled endpoint.

Impact

Successful discovery of sensitive files can lead to the compromise of password databases and plain-text credential files, significantly increasing the risk of full account takeover, lateral movement across the network, and long-term persistence through harvested authentication tokens.

Recommendation

  1. Enable PowerShell Script Block Logging (Event ID 4104) across all Windows endpoints to ensure the visibility of script execution.
  2. Deploy the provided Sigma rule to detect recursive file searches targeting known credential file extensions.
  3. Perform threat hunting for common PowerShell enumeration patterns and investigate high-frequency recursive search activity from unauthorized user accounts.

Immediate actions

Enable PowerShell Script Block Logging (Event ID 4104) across all endpoints

IT Operations 48h

Threat Hunt

Search for high-frequency use of recursive search flags in PowerShell logs

T1083 medium medium confidence convert to detection

Data: PowerShell Operational Logs (Event 4104)

Mitigations

Implement strict access controls on directories containing sensitive credential files

medium Security Architecture

Discovery of credentials

Detection coverage 1

Detect Sensitive File Discovery via PowerShell

medium

Detects the use of PowerShell cmdlets to recursively search for sensitive file extensions such as .pass, .kdbx, or .kdb

sigma tactics: discovery techniques: T1083 sources: process_creation, windows

Detection queries are available on the platform. Get full rules →