Windows PowerShell ScriptBlock with Encoded, Hidden, or Noninteractive Execution Parameters

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

FreeReviewedSigma · High · v2
Product
windows
Category
ps_script
Author
Florian Roth (Nextron Systems) (SigmaHQ), DRL 1.1
Published
2017-03-12
Updated
2026-07-31
title: Windows PowerShell ScriptBlock with Encoded, Hidden, or Noninteractive Execution Parameters
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 script block text that includes command parameters commonly used to alter execution behavior, such as encoded command flags, hidden window options, or noninteractive mode. Attackers use encoded and hidden/noninteractive execution to reduce visibility and complicate analysis while still running malicious logic. It relies on Windows PowerShell Script Block Logging telemetry that captures ScriptBlockText content for these parameter patterns.
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