PowerShell Script Block Collection of Documents via Recursive Get-ChildItem

Alerts on PowerShell file enumeration that recursively searches and includes common document extensions via Get-ChildItem.

FreeReviewedSigma · Medium · v2
Product
windows
Category
ps_script
Author
frack113 (SigmaHQ), DRL 1.1
Published
2021-07-28
Updated
2026-07-31
title: PowerShell Script Block Collection of Documents via Recursive Get-ChildItem
id: a1bf4226-f394-43e6-b624-d78284dba6d1
status: test
description: This rule flags PowerShell script blocks that both recursively enumerate files and include common document extensions such as .doc/.docx, .xls/.xlsx, .ppt/.pptx, .rtf, .pdf, and .txt. Adversaries can use this automated discovery behavior to locate and stage internal data for later collection or exfiltration. It relies on ScriptBlockText contents from PowerShell script block logging on Windows and matches specific text patterns within the script block.
references:
  - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1119/T1119.md
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/powershell/powershell_script/posh_ps_automated_collection.yml
author: frack113, Huntrule Team
date: 2021-07-28
modified: 2022-12-25
tags:
  - attack.collection
  - attack.t1119
logsource:
  product: windows
  category: ps_script
  definition: "Requirements: Script Block Logging must be enabled"
detection:
  selection_ext:
    ScriptBlockText|contains:
      - .doc
      - .docx
      - .xls
      - .xlsx
      - .ppt
      - .pptx
      - .rtf
      - .pdf
      - .txt
  selection_cmd:
    ScriptBlockText|contains|all:
      - Get-ChildItem
      - " -Recurse "
      - " -Include "
  condition: all of selection*
falsepositives:
  - Unknown
level: medium
license: DRL-1.1
related:
  - id: c1dda054-d638-4c16-afc8-53e007f3fbc5
    type: derived