PowerShell User Discovery and Export with Get-ADUser

Flags PowerShell Get-ADUser enumeration (filter *) followed by exporting results to a file.

FreeUnreviewedSigmamediumv1
title: PowerShell User Discovery and Export with Get-ADUser
id: 45fd0a9b-b046-4f53-a96b-e68fc4539e7e
related:
  - id: c2993223-6da8-4b1a-88ee-668b8bf315e9
    type: similar
  - id: 1114e048-b69c-4f41-bc20-657245ae6e3f
    type: derived
status: test
description: This rule identifies PowerShell execution of the Get-ADUser cmdlet with a broad filter ("-Filter *") and subsequent export of results to a file. Attackers use this to enumerate directory users for targeting, discovery, or later collection steps. It relies on Windows process creation telemetry capturing PowerShell command lines that include the Get-ADUser usage and file output via redirection or common output cmdlets.
references:
  - http://blog.talosintelligence.com/2022/09/lazarus-three-rats.html
  - https://www.microsoft.com/en-us/security/blog/2022/10/18/defenders-beware-a-case-for-post-ransomware-investigations/
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_powershell_user_discovery_get_aduser.yml
author: Nasreddine Bencherchali (Nextron Systems), Huntrule Team
date: 2022-09-09
modified: 2022-11-17
tags:
  - attack.discovery
  - attack.t1033
logsource:
  category: process_creation
  product: windows
detection:
  selection_img:
    - Image|endswith:
        - \powershell.exe
        - \pwsh.exe
    - OriginalFileName:
        - PowerShell.EXE
        - pwsh.dll
  selection_cli:
    CommandLine|contains|all:
      - "Get-ADUser "
      - " -Filter \\*"
    CommandLine|contains:
      - " > "
      - " | Select "
      - Out-File
      - Set-Content
      - Add-Content
  condition: all of selection_*
falsepositives:
  - Legitimate admin scripts may use the same technique, it's better to exclude specific computers or users who execute these commands or scripts often
level: medium
license: DRL-1.1

What it detects

This rule identifies PowerShell execution of the Get-ADUser cmdlet with a broad filter ("-Filter *") and subsequent export of results to a file. Attackers use this to enumerate directory users for targeting, discovery, or later collection steps. It relies on Windows process creation telemetry capturing PowerShell command lines that include the Get-ADUser usage and file output via redirection or common output cmdlets.

Known false positives

  • Legitimate admin scripts may use the same technique, it's better to exclude specific computers or users who execute these commands or scripts often

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