Detectionlowtest

Suspicious PowerShell Get Current User

Detects the use of PowerShell to identify the current logged user.

Open in Detection LabConvert ruleBuild Package
François HubautCreated 2022-04-044096a49c-7de4-4da0-a230-c66ccd56ea5awindows
Log Source
WindowsPowerShell Script
ProductWindows← raw: windows
CategoryPowerShell Script← raw: ps_script

Definition

Requirements: Script Block Logging must be enabled

Detection Logic
Detection Logic1 selector
detection:
    selection:
        ScriptBlockText|contains:
            - '[System.Environment]::UserName'
            - '$env:UserName'
            - '[System.Security.Principal.WindowsIdentity]::GetCurrent()'
    condition: selection
False Positives

Legitimate PowerShell scripts

Rule Metadata
Rule ID
4096a49c-7de4-4da0-a230-c66ccd56ea5a
Status
test
Level
low
Type
Detection
Created
2022-04-04
Path
rules/windows/powershell/powershell_script/posh_ps_susp_get_current_user.yml
Raw Tags
attack.discoveryattack.t1033
View on GitHub