Windows Security EID 4697: mshta Used to Run Obfuscated VBScript PowerShell

Detects service creation where the binary path includes mshta plus VBS/automation indicators consistent with script-based obfuscation.

FreeReviewedSigma · High · v2
Product
windows
Service
security
Author
Nikita Nazarov, oscd.community (SigmaHQ), DRL 1.1
Published
2020-10-09
Updated
2026-07-31
title: "Windows Security EID 4697: mshta Used to Run Obfuscated VBScript PowerShell"
id: c7608674-23dd-4a83-b9bb-965c4c5f5ec8
related:
  - id: 7e9c7999-0f9b-4d4a-a6ed-af6d553d4af4
    type: derived
  - id: 9b8d9203-4e0f-4cd9-bb06-4cc4ea6d0e9a
    type: derived
status: test
description: This rule flags Windows Security audit events (EID 4697) where the installed service file name contains mshta along with VBScript automation patterns commonly used to execute obfuscated PowerShell. Attackers may use this technique to hide intent and launch script-based execution via mshta. Detection relies on Security log telemetry capturing the ServiceFileName string for EID 4697 and matching required substrings.
references:
  - https://github.com/SigmaHQ/sigma/issues/1009
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/builtin/security/win_security_invoke_obfuscation_via_use_mshta_services_security.yml
author: Nikita Nazarov, oscd.community, Huntrule Team
date: 2020-10-09
modified: 2022-11-29
tags:
  - attack.stealth
  - attack.t1027
  - attack.execution
  - attack.t1059.001
logsource:
  product: windows
  service: security
  definition: The 'System Security Extension' audit subcategory need to be enabled to log the EID 4697
detection:
  selection:
    EventID: 4697
    ServiceFileName|contains|all:
      - mshta
      - vbscript:createobject
      - .run
      - window.close
  condition: selection
falsepositives:
  - Unknown
level: high
license: DRL-1.1