Detectionmediumtest

Powershell Sensitive File Discovery

Detect adversaries enumerate sensitive files

Open in Detection LabConvert ruleBuild Package
François HubautCreated 2022-09-16Updated 2026-10-147d416556-6502-45b2-9bad-9d2f05f38997windows
Log Source
WindowsPowerShell Script
ProductWindows← raw: windows
CategoryPowerShell Script← raw: ps_script

Definition

Requirements: Script Block Logging must be enabled

Detection Logic
Detection Logic3 selectors
detection:
    selection_action:
        # Whole words only: as plain substrings, 'ls' and 'gci' also match words such as 'false' or 'credentials'
        ScriptBlockText|re|i: '\b(?:get-childitem|gci|ls|dir)\b'
    selection_recurse:
        ScriptBlockText|contains: '-recurse'
    selection_file:
        ScriptBlockText|contains:
            - '.pass'
            - '.kdbx'
            - '.kdb'
    condition: all of selection_*
False Positives
Unknown

False positive likelihood has not been assessed. Additional context may be needed during triage.

Testing & Validation

Regression Tests

by frack113
Positive Detection Test1 matchevtx

Microsoft-Windows-PowerShell

Related Rules
Derived

d23f2ba5-9da0-4463-8908-8ee47f614bb9

Rule not found
Rule Metadata
Rule ID
7d416556-6502-45b2-9bad-9d2f05f38997
Status
test
Level
medium
Type
Detection
Created
2022-09-16
Modified
2026-10-14
Path
rules/windows/powershell/powershell_script/posh_ps_sensitive_file_discovery.yml
Raw Tags
attack.discoveryattack.t1083
View on GitHub