Suspicious PowerShell ScriptBlock Parameters: -enc, Hidden Window, and Noninteractive

Alerts on PowerShell ScriptBlockText containing encoded command, hidden window, or noninteractive execution parameters.

FreeUnreviewedSigmahighv1
title: "Suspicious PowerShell ScriptBlock Parameters: -enc, Hidden Window, and Noninteractive"
id: 33f0cec5-edfb-4af0-b065-5163dff1667c
related:
  - id: 3d304fda-78aa-43ed-975c-d740798a49c1
    type: derived
  - id: bbb80e91-5746-4fbe-8898-122e2cafdbf4
    type: similar
  - id: ed965133-513f-41d9-a441-e38076a0798f
    type: derived
status: test
description: This rule flags PowerShell executions whose script block text contains command-line parameters commonly used to change execution visibility or interaction. Attackers use encoded commands, hidden or minimized windows, and noninteractive modes to reduce user awareness and hinder analysis. The detection relies on Windows PowerShell Script Block Logging telemetry, specifically the ScriptBlockText field containing these parameter strings.
references:
  - Internal Research
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/powershell/powershell_script/posh_ps_susp_invocation_generic.yml
author: Florian Roth (Nextron Systems), Huntrule Team
date: 2017-03-12
modified: 2023-01-03
tags:
  - attack.execution
  - attack.t1059.001
logsource:
  product: windows
  category: ps_script
  definition: "Requirements: Script Block Logging must be enabled"
detection:
  selection_encoded:
    ScriptBlockText|contains:
      - " -enc "
      - " -EncodedCommand "
      - " -ec "
  selection_hidden:
    ScriptBlockText|contains:
      - " -w hidden "
      - " -window hidden "
      - " -windowstyle hidden "
      - " -w 1 "
  selection_noninteractive:
    ScriptBlockText|contains:
      - " -noni "
      - " -noninteractive "
  condition: all of selection*
falsepositives:
  - Very special / sneaky PowerShell scripts
level: high
license: DRL-1.1

What it detects

This rule flags PowerShell executions whose script block text contains command-line parameters commonly used to change execution visibility or interaction. Attackers use encoded commands, hidden or minimized windows, and noninteractive modes to reduce user awareness and hinder analysis. The detection relies on Windows PowerShell Script Block Logging telemetry, specifically the ScriptBlockText field containing these parameter strings.

Known false positives

  • Very special / sneaky PowerShell scripts

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