Detect Mshta in Sumo Logic CSE
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/
Sumo Detection Query
(_sourceCategory=*windows* OR _sourceCategory=*sysmon* OR _sourceCategory=*WinEventLog*)
| where !isNull(EventCode) and EventCode = "1"
| where Image matches "(?i).*mshta\.exe" OR ParentImage matches "(?i).*mshta\.exe"
| if(CommandLine matches "(?i)https?://", 1, 0) as RemoteURL
| if(CommandLine matches "(?i)(vbscript:|javascript:)", 1, 0) as InlineScript
| if(CommandLine matches "(?i)GetObject", 1, 0) as GetObject
| if(CommandLine matches "(?i)(WScript\.Shell|Shell\.Application|CreateObject|ActiveXObject)", 1, 0) as ShellInvoke
| if(ParentImage matches "(?i)(winword|excel|outlook|powerpnt)\.exe", 1, 0) as OfficeParent
| if(CommandLine matches "(?i)(Temp|AppData|Downloads|Desktop|Public)", 1, 0) as HTAPath
| if(ParentImage matches "(?i).*mshta\.exe" AND Image matches "(?i)(cmd|powershell|wscript|cscript|certutil|bitsadmin|regsvr32|rundll32)\.exe", 1, 0) as SuspiciousChild
| RemoteURL + InlineScript + GetObject + ShellInvoke + OfficeParent + HTAPath + SuspiciousChild as RiskScore
| where RiskScore > 0 OR ParentImage matches "(?i).*mshta\.exe"
| fields _messageTime, Computer, User, Image, CommandLine, ParentImage, ParentCommandLine, RemoteURL, InlineScript, GetObject, ShellInvoke, OfficeParent, HTAPath, SuspiciousChild, RiskScore
| sort by _messageTime desc Sumo Logic log search query detecting T1218.005 mshta.exe abuse via Sysmon Event ID 1 (Process Create). Computes a risk score across seven behavioural indicators matching the same logic as the SPL reference query. Surfaces both mshta.exe invocations with suspicious arguments and any process whose parent is mshta.exe, returning all evidence fields for analyst triage. Designed for Sumo Logic Cloud SIEM or standalone log search against Windows/Sysmon source categories.
Data Sources
Required Tables
False Positives & Tuning
- Legacy line-of-business applications built on the Microsoft HTA platform that legitimately invoke WScript.Shell or CreateObject to interact with local COM automation interfaces — common in older healthcare and legal document management systems
- SCCM task sequences or PDQ Deploy jobs that unpack HTA-based setup UIs into the user's Temp or AppData directory as part of a managed software install, simultaneously triggering HTAPath and ShellInvoke indicators
- Security awareness or phishing simulation platforms (e.g. KnowBe4, Proofpoint Security Awareness) that use benign mshta payloads to demonstrate phishing risk to end users during authorised exercises
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.
- 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.
- 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.
- 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.
References (7)
- https://attack.mitre.org/techniques/T1218/005/
- https://lolbas-project.github.io/lolbas/Binaries/Mshta/
- https://www.redcanary.com/blog/microsoft-html-application-hta-abuse-part-deux/
- https://www.fireeye.com/blog/threat-research/2017/04/fin7-phishing-lnk.html
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1218.005/T1218.005.md
- https://www.fireeye.com/blog/threat-research/2017/04/cve-2017-0199-hta-handler.html
- https://msdn.microsoft.com/library/ms536471.aspx
Unlock Pro Content
Get the full detection package for T1218.005 including response playbook, investigation guide, and atomic red team tests.