Mshta
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.
let SuspiciousPatterns = dynamic([
"http://", "https://", "vbscript:", "javascript:",
"GetObject", "WScript.Shell", "Shell.Application",
"CreateObject", "ActiveXObject", "cmd.exe", "powershell"
]);
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "mshta.exe"
| extend RemoteURL = ProcessCommandLine has_any ("http://", "https://")
| extend InlineScript = ProcessCommandLine has_any ("vbscript:", "javascript:")
| extend GetObject = ProcessCommandLine has "GetObject"
| extend ShellInvoke = ProcessCommandLine has_any ("WScript.Shell", "Shell.Application", "CreateObject")
| extend SuspiciousParent = InitiatingProcessFileName has_any ("winword.exe", "excel.exe", "outlook.exe", "powerpnt.exe", "explorer.exe")
| extend HTAPath = ProcessCommandLine has_any ("Temp", "AppData", "Downloads", "Desktop", "Public")
| project Timestamp, DeviceName, AccountName, ProcessCommandLine, InitiatingProcessFileName,
InitiatingProcessCommandLine, RemoteURL, InlineScript, GetObject, ShellInvoke, SuspiciousParent, HTAPath
| sort by Timestamp desc
union (
DeviceProcessEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName =~ "mshta.exe"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine
| sort by Timestamp desc
) Data Sources
Required Tables
False Positives
- 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
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.