Detection rules › Sigma

MSHTA Execution with Suspicious File Extensions

Status
test
Severity
high
Log source
category process_creation, product windows
Author
Diego Perez (@darkquassar), Markus Neis, Swisscom (Improve Rule), Swachchhanda Shrawan Poudel (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects execution of mshta.exe with file types that looks like they do not typically represent HTA (HTML Application) content, such as .png, .jpg, .zip, .pdf, and others, which are often polyglots. MSHTA is a legitimate Windows utility for executing HTML Applications containing VBScript or JScript. Threat actors often abuse this lolbin utility to download and execute malicious scripts disguised as benign files or hosted under misleading extensions to evade detection.

Known false positives

  • False positives depend on scripts and administrative tools used in the monitored environment

MITRE ATT&CK coverage

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 1: Process creation

Rule body

title: MSHTA Execution with Suspicious File Extensions
id: cc7abbd0-762b-41e3-8a26-57ad50d2eea3
status: test
description: |
    Detects execution of mshta.exe with file types that looks like they do not typically represent HTA (HTML Application) content,
    such as .png, .jpg, .zip, .pdf, and others, which are often polyglots. MSHTA is a legitimate Windows utility for executing HTML Applications
    containing VBScript or JScript. Threat actors often abuse this lolbin utility to download and
    execute malicious scripts disguised as benign files or hosted under misleading extensions to evade detection.
references:
    - http://blog.sevagas.com/?Hacking-around-HTA-files
    - https://0x00sec.org/t/clientside-exploitation-in-2018-how-pentesting-has-changed/7356
    - https://learn.microsoft.com/en-us/previous-versions/dotnet/framework/data/xml/xslt/xslt-stylesheet-scripting-using-msxsl-script
    - https://medium.com/tsscyber/pentesting-and-hta-bypassing-powershell-constrained-language-mode-53a42856c997
    - https://twitter.com/mattifestation/status/1326228491302563846
    - https://www.virustotal.com/gui/file/c1f27d9795a2eba630db8a043580a0761798f06370fb1317067805f8a845b00c
author: Diego Perez (@darkquassar), Markus Neis, Swisscom (Improve Rule), Swachchhanda Shrawan Poudel (Nextron Systems)
date: 2019-02-22
modified: 2025-05-12
tags:
    - attack.stealth
    - attack.t1140
    - attack.t1218.005
    - attack.execution
    - attack.t1059.007
    - cve.2020-1599
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        - Image|endswith: '\mshta.exe'
        - OriginalFileName: 'mshta.exe'
    selection_cli:
        CommandLine|contains:
            - '.7z'
            - '.avi'
            - '.bat'
            - '.bmp'
            - '.conf'
            - '.csv'
            - '.dll'
            - '.doc'
            - '.gif'
            - '.gz'
            - '.ini'
            - '.jpe'
            - '.jpg'
            - '.json'
            - '.lnk'
            - '.log'
            - '.mkv'
            - '.mp3'
            - '.mp4'
            - '.pdf'
            - '.png'
            - '.ppt'
            - '.rar'
            - '.rtf'
            - '.svg'
            - '.tar'
            - '.tmp'
            - '.txt'
            - '.xls'
            - '.xml'
            - '.yaml'
            - '.yml'
            - '.zip'
            - 'vbscript'
            # - '.chm'  # could be prone to false positives
            # - '.exe'
    condition: all of selection_*
falsepositives:
    - False positives depend on scripts and administrative tools used in the monitored environment
level: high

Stages and Predicates

Stage 0: condition

all of selection_*

Stage 1: selection_img

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

Stage 2: selection_cli

selection_cli:
    CommandLine|contains:
        - '.7z'
        - '.avi'
        - '.bat'
        - '.bmp'
        - '.conf'
        - '.csv'
        - '.dll'
        - '.doc'
        - '.gif'
        - '.gz'
        - '.ini'
        - '.jpe'
        - '.jpg'
        - '.json'
        - '.lnk'
        - '.log'
        - '.mkv'
        - '.mp3'
        - '.mp4'
        - '.pdf'
        - '.png'
        - '.ppt'
        - '.rar'
        - '.rtf'
        - '.svg'
        - '.tar'
        - '.tmp'
        - '.txt'
        - '.xls'
        - '.xml'
        - '.yaml'
        - '.yml'
        - '.zip'
        - 'vbscript'

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
CommandLinematch
  • .7z corpus 2 (sigma 2)
  • .avi
  • .bat corpus 11 (sigma 9, elastic 1, kusto 1)
  • .bmp corpus 3 (sigma 2, elastic 1)
  • .conf
  • .csv corpus 2 (sigma 2)
  • .dll corpus 16 (sigma 16)
  • .doc corpus 4 (sigma 4)
  • .gif corpus 9 (sigma 8, elastic 1)
  • .gz
  • .ini
  • .jpe
  • .jpg corpus 8 (sigma 7, elastic 1)
  • .json
  • .lnk corpus 3 (sigma 3)
  • .log corpus 4 (sigma 4)
  • .mkv
  • .mp3 corpus 2 (sigma 2)
  • .mp4
  • .pdf corpus 3 (sigma 3)
  • .png corpus 8 (sigma 7, elastic 1)
  • .ppt corpus 4 (sigma 4)
  • .rar corpus 2 (sigma 2)
  • .rtf corpus 2 (sigma 2)
  • .svg corpus 2 (sigma 2)
  • .tar
  • .tmp corpus 3 (sigma 3)
  • .txt corpus 9 (sigma 9)
  • .xls corpus 4 (sigma 4)
  • .xml corpus 6 (sigma 4, splunk 2)
  • .yaml
  • .yml corpus 2 (sigma 2)
  • .zip corpus 6 (sigma 5, chronicle 1)
  • vbscript corpus 3 (sigma 2, splunk 1)
field:"CommandLine" kind:match
Imageends_with
  • \mshta.exe corpus 66 (sigma 66)
field:"Image" kind:ends_with value:"\mshta.exe"
OriginalFileNameeq
  • mshta.exe corpus 40 (elastic 21, sigma 13, splunk 6)
field:"OriginalFileName" kind:eq value:"mshta.exe"