Detection rules › Sigma

Suspicious Mshta.EXE Execution Patterns

Status
test
Severity
high
Log source
product windows, category process_creation
Author
Florian Roth (Nextron Systems), Nasreddine Bencherchali (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects suspicious mshta process execution patterns

MITRE ATT&CK coverage

TacticTechniques
ExecutionT1106 Native API

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: Suspicious Mshta.EXE Execution Patterns
id: e32f92d1-523e-49c3-9374-bdb13b46a3ba
status: test
description: Detects suspicious mshta process execution patterns
references:
    - https://en.wikipedia.org/wiki/HTML_Application
    - https://www.echotrail.io/insights/search/mshta.exe
    - https://app.any.run/tasks/34221348-072d-4b70-93f3-aa71f6ebecad/
author: Florian Roth (Nextron Systems), Nasreddine Bencherchali (Nextron Systems)
date: 2021-07-17
modified: 2023-02-21
tags:
    - attack.execution
    - attack.t1106
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        - Image|endswith: '\mshta.exe'
        - OriginalFileName: 'MSHTA.EXE'
    selection_susp:
        # Suspicious parents
        ParentImage|endswith:
            - '\cmd.exe'
            - '\cscript.exe'
            - '\powershell.exe'
            - '\pwsh.exe'
            - '\regsvr32.exe'
            - '\rundll32.exe'
            - '\wscript.exe'
        # Suspicious folders
        CommandLine|contains:
            - '\AppData\Local\'
            - 'C:\ProgramData\'
            - 'C:\Users\Public\'
            - 'C:\Windows\Temp\'
    filter_img:
        # Filter legit Locations
        - Image|startswith:
              - 'C:\Windows\System32\'
              - 'C:\Windows\SysWOW64\'
        # Suspicious extensions
        - CommandLine|contains:
              - '.htm'
              - '.hta'
        # Filter simple execution
        - CommandLine|endswith:
              - 'mshta.exe'
              - 'mshta'
    condition: all of selection_* or (selection_img and not filter_img)
falsepositives:
    - Unknown
level: high

Stages and Predicates

Stage 0: condition

all of selection_* or (selection_img and not filter_img)

Stage 1: selection_img

selection_img:
    - Image|endswith: '\mshta.exe'
    - OriginalFileName: 'MSHTA.EXE'

Stage 2: selection_susp

selection_susp:
    ParentImage|endswith:
        - '\cmd.exe'
        - '\cscript.exe'
        - '\powershell.exe'
        - '\pwsh.exe'
        - '\regsvr32.exe'
        - '\rundll32.exe'
        - '\wscript.exe'
    CommandLine|contains:
        - '\AppData\Local\'
        - 'C:\ProgramData\'
        - 'C:\Users\Public\'
        - 'C:\Windows\Temp\'

Stage 3: selection_img

selection_img:
    - Image|endswith: '\mshta.exe'
    - OriginalFileName: 'MSHTA.EXE'

Stage 4: not filter_img

filter_img:
    - Image|startswith:
          - 'C:\Windows\System32\'
          - 'C:\Windows\SysWOW64\'
    - CommandLine|contains:
          - '.htm'
          - '.hta'
    - CommandLine|endswith:
          - 'mshta.exe'
          - 'mshta'

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
CommandLineends_withmshta
CommandLineends_withmshta.exe
CommandLinematch.hta
CommandLinematch.htm
Imagestarts_withC:\Windows\SysWOW64\
Imagestarts_withC:\Windows\System32\

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
CommandLinematch
  • C:\ProgramData\ corpus 6 (sigma 6)
  • C:\Users\Public\ corpus 2 (sigma 2)
  • C:\Windows\Temp\ corpus 7 (sigma 7)
  • \AppData\Local\ corpus 10 (sigma 10)
Imageends_with
  • \mshta.exe corpus 67 (sigma 67)
OriginalFileNameeq
  • MSHTA.EXE corpus 22 (sigma 13, splunk 6, elastic 3)
ParentImageends_with
  • \cmd.exe corpus 20 (sigma 20)
  • \cscript.exe corpus 17 (sigma 17)
  • \powershell.exe corpus 24 (sigma 24)
  • \pwsh.exe corpus 21 (sigma 21)
  • \regsvr32.exe corpus 11 (sigma 11)
  • \rundll32.exe corpus 15 (sigma 15)
  • \wscript.exe corpus 19 (sigma 19)