Suspicious JavaScript Execution Via Mshta.EXE
Detection of attackers using the Windows mshta.exe utility to execute malicious JavaScript code for living-off-the-land stealth execution.
This brief addresses the abuse of mshta.exe, a legitimate Windows utility designed to execute Microsoft HTML Applications (.hta). Attackers leverage this binary to execute arbitrary JavaScript or VBScript via command-line arguments to bypass security controls. By passing script code directly to mshta.exe, malicious actors achieve fileless execution or stage secondary payloads without triggering standard script-based blocklists. This technique is frequently observed in the early stages of post-exploitation to establish persistence or execute initial loader scripts. Defenders should monitor for command-line arguments explicitly invoking JavaScript engines through mshta.exe.
Impact
Successful abuse of mshta.exe allows attackers to execute code in the context of the current user, potentially facilitating credential harvesting, malware delivery, or lateral movement within an environment.
Recommendation
Deploy the provided Sigma rule to detect suspicious process creation events involving mshta.exe. Ensure process-level command-line logging is enabled via Sysmon (Event ID 1) or Windows Security Event Logs (Event ID 4688 with command line auditing enabled). Investigate any instances where mshta.exe is launched from non-standard parent processes or contains obfuscated script content.
Immediate actions
Deploy the provided Sigma rule to SIEM
Threat Hunt
Search for mshta.exe execution containing 'javascript:' or 'vbscript:' in command lines
Data: Process creation logs
Detection coverage 1
Detect Suspicious JavaScript Execution Via Mshta.EXE
highDetects execution of JavaScript code using mshta.exe, a technique used by attackers for fileless payload delivery.
Detection queries are available on the platform. Get full rules →