Windows Security Event 4697: mshta Script Obfuscation Indicators

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

FreeUnreviewedSigmahighv1
title: "Windows Security Event 4697: mshta Script Obfuscation Indicators"
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 System Security Extension events where a new service binary path contains mshta along with multiple script-automation indicators: vbscript:createobject, .run, and window.close. Attackers often use mshta to execute script content indirectly, a common approach to evade straightforward command-line inspection. The detection relies on Security log EventID 4697 and matches substrings within the recorded service file name for mshta and its embedded script patterns."
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

What it detects

This rule flags Windows System Security Extension events where a new service binary path contains mshta along with multiple script-automation indicators: vbscript:createobject, .run, and window.close. Attackers often use mshta to execute script content indirectly, a common approach to evade straightforward command-line inspection. The detection relies on Security log EventID 4697 and matches substrings within the recorded service file name for mshta and its embedded script patterns.

Known false positives

  • Unknown

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