Suspicious PowerShell Get Current User

 Original Source: [Sigma source]
Title: Suspicious PowerShell Get Current User
Status: test
Description:Detects the use of PowerShell to identify the current logged user.
References:
  -https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1033/T1033.md#atomic-test-4---user-discovery-with-env-vars-powershell-script
  -https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1033/T1033.md#atomic-test-5---getcurrent-user-with-powershell-script
Author: frack113
Date: 2022-04-04
modified:None
Tags:
  • -'attack.discovery'
  • -'attack.t1033'
Logsource:
  • product: windows
  • category: ps_script
  • definition: Requirements: Script Block Logging must be enabled
Detection:
  selection:
    ScriptBlockText|contains:
      -'[System.Environment]::UserName'
      -'$env:UserName'
      -'[System.Security.Principal.WindowsIdentity]::GetCurrent()'

  condition:selection
Falsepositives:
  -Legitimate PowerShell scripts
Level: low