T1218.005 Splunk · SPL

Detect Mshta in Splunk

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/

SPL Detection Query

Splunk (SPL)
spl
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
(Image="*\\mshta.exe" OR ParentImage="*\\mshta.exe")
| eval RemoteURL=if(match(CommandLine, "http[s]?://"), 1, 0)
| eval InlineScript=if(match(CommandLine, "(vbscript:|javascript:)"), 1, 0)
| eval GetObject=if(match(CommandLine, "GetObject"), 1, 0)
| eval ShellInvoke=if(match(CommandLine, "(WScript\.Shell|Shell\.Application|CreateObject|ActiveXObject)"), 1, 0)
| eval OfficeParent=if(match(ParentImage, "(winword|excel|outlook|powerpnt)\.exe"), 1, 0)
| eval HTAPath=if(match(CommandLine, "(Temp|AppData|Downloads|Desktop|Public)"), 1, 0)
| eval SuspiciousChild=if(ParentImage="*\\mshta.exe" AND match(Image, "(cmd|powershell|wscript|cscript|certutil|bitsadmin|regsvr32|rundll32)\.exe"), 1, 0)
| eval RiskScore=RemoteURL + InlineScript + GetObject + ShellInvoke + OfficeParent + HTAPath + SuspiciousChild
| where RiskScore > 0 OR ParentImage="*\\mshta.exe"
| table _time, host, User, Image, CommandLine, ParentImage, ParentCommandLine, RemoteURL, InlineScript, GetObject, ShellInvoke, OfficeParent, HTAPath, SuspiciousChild, RiskScore
| sort - _time
high severity high confidence

Detects mshta.exe abuse using Sysmon Event ID 1 with comprehensive risk scoring. Evaluates remote URL loading, inline script execution, object creation patterns, suspicious file paths, Office application parents, and child process spawning. High risk scores (3+) indicate likely malicious activity; child process spawning from mshta is almost always malicious.

Data Sources

Process: Process CreationCommand: Command ExecutionSysmon Event ID 1

Required Sourcetypes

XmlWinEventLog:Microsoft-Windows-Sysmon/Operational

False Positives & Tuning

  • Legacy enterprise applications that use HTA files for management interfaces or configuration wizards
  • Some older IT management tools (HP, Dell BIOS update utilities) that use HTA for their installation UI
  • Legitimate corporate HTA-based tools deployed by IT for specific administrative tasks
  • Software vendors whose legacy applications use HTA for splash screens or update notifications
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