T1218.005 Elastic Security · Elastic

Detect Mshta in Elastic Security

Adversaries may abuse mshta.exe to proxy execution of malicious .hta files and Javascript or VBScript through a trusted Windows utility. Mshta.exe executes Microsoft HTML Applications (HTA) files outside of the Internet Explorer browser security context, bypassing browser security settings and application control solutions. HTA files can be loaded locally, from remote URLs (mshta http://server/payload.hta), or as inline scripts (mshta vbscript:...). This technique is widely used by nation-state APTs including FIN7, Lazarus Group, APT29, APT32, MuddyWater, Kimsuky, Sidewinder, Gamaredon, and many others, making it one of the most commonly abused LOLBins for initial access and execution.

MITRE ATT&CK

Tactic
Defense Evasion
Technique
T1218 System Binary Proxy Execution
Sub-technique
T1218.005 Mshta
Canonical reference
https://attack.mitre.org/techniques/T1218/005/

Elastic Detection Query

Elastic Security (Elastic)
eql
process where event.type == "start" and
(
  (
    process.name : "mshta.exe" and
    (
      process.command_line : ("*http://*", "*https://*", "*vbscript:*", "*javascript:*",
                               "*GetObject*", "*WScript.Shell*", "*Shell.Application*",
                               "*CreateObject*", "*ActiveXObject*", "*cmd.exe*", "*powershell*") or
      process.parent.name : ("winword.exe", "excel.exe", "outlook.exe", "powerpnt.exe", "explorer.exe") or
      process.command_line : ("*\\Temp\\*", "*\\AppData\\*", "*\\Downloads\\*", "*\\Desktop\\*", "*\\Public\\*")
    )
  ) or
  (
    process.parent.name : "mshta.exe" and
    process.name : ("cmd.exe", "powershell.exe", "wscript.exe", "cscript.exe",
                    "certutil.exe", "bitsadmin.exe", "regsvr32.exe", "rundll32.exe")
  )
)
high severity high confidence

Detects suspicious mshta.exe execution patterns including remote URL loading, inline VBScript/JavaScript, shell object invocation, Office application parent processes, HTA files in writable user paths, and mshta.exe spawning high-risk child processes. Covers both direct mshta.exe execution with suspicious arguments and its use as a parent for follow-on payload execution. Maps to T1218.005.

Data Sources

Elastic Endpoint SecurityWindows Sysmon (via Elastic Agent)Elastic Defend

Required Tables

logs-endpoint.events.process-*.ds-logs-windows.sysmon_operational-*logs-system.security-*

False Positives & Tuning

  • Legacy enterprise applications that ship legitimate HTA-based administrative consoles or installer wizards — particularly common in older healthcare, finance, and manufacturing ISV software that has not been modernised away from IE-era tooling
  • IT provisioning or helpdesk workflows using SCCM/ConfigMgr or custom HTA front-ends to guide technicians through build steps; these frequently load HTA files from UNC paths or local AppData staging directories
  • Developer and QA workstations actively building or testing HTA-based tooling where inline script evaluation or CreateObject calls are expected behaviour during the development cycle
Download portable Sigma rule (.yml)

Other platforms for T1218.005


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Mshta Remote HTA Execution

    Expected signal: Sysmon Event ID 1: mshta.exe with URL in command line. Sysmon Event ID 3: Network connection attempt to 127.0.0.1:8080. Sysmon Event ID 22 (DNS Query) if a domain was used instead of IP. Security Event ID 4688.

  2. Test 2Mshta Inline VBScript Execution

    Expected signal: Sysmon Event ID 1: mshta.exe with 'vbscript:' and 'CreateObject' in command line. Sysmon Event ID 1: cmd.exe as a child of mshta.exe. Sysmon Event ID 11: File created at temp path. Security Event ID 4688 for both processes.

  3. Test 3Mshta Launched from Office Application Path

    Expected signal: Sysmon Event ID 1: cmd.exe, then mshta.exe with vbscript: and Execute in command line. InlineScript, GetObject/ShellInvoke indicators fire. If the obfuscated CreateObject resolves, WScript.Shell child process spawns calc.exe as grandchild of mshta.

Unlock Pro Content

Get the full detection package for T1218.005 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections