PowerShell ScriptBlock Obfuscation via MSHTA VBScript CreateObject Execution

Alerts on PowerShell script blocks containing mshta and VBScript createobject/.run/window.close patterns consistent with obfuscated execution.

FreeReviewedSigma · High · v2
Product
windows
Category
ps_script
Author
Nikita Nazarov, oscd.community (SigmaHQ), DRL 1.1
Published
2020-10-08
Updated
2026-07-31
title: PowerShell ScriptBlock Obfuscation via MSHTA VBScript CreateObject Execution
id: f86282e7-e5ed-432b-9fc5-6117e4001317
status: test
description: This rule identifies PowerShell script block content that includes multiple MSHTA and VBScript execution indicators in the same block, suggesting obfuscated or staged execution. Attackers often use MSHTA with VBScript to launch processes while hiding intent within scripted content. The detection relies on Script Block Logging telemetry by matching specific string combinations within ScriptBlockText.
references:
  - https://github.com/SigmaHQ/sigma/issues/1009
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/powershell/powershell_script/posh_ps_invoke_obfuscation_via_use_mhsta.yml
author: Nikita Nazarov, oscd.community, Huntrule Team
date: 2020-10-08
modified: 2022-11-29
tags:
  - attack.stealth
  - attack.t1027
  - attack.execution
  - attack.t1059.001
logsource:
  product: windows
  category: ps_script
  definition: "Requirements: Script Block Logging must be enabled"
detection:
  selection_4104:
    ScriptBlockText|contains|all:
      - set
      - "&&"
      - mshta
      - vbscript:createobject
      - .run
      - (window.close)
  condition: selection_4104
falsepositives:
  - Unknown
level: high
license: DRL-1.1
related:
  - id: e55a5195-4724-480e-a77e-3ebe64bd3759
    type: derived