Query Details
# MSHTA Executions ## Query Information #### MITRE ATT&CK Technique(s) | Technique ID | Title | Link | | --- | --- | --- | | T1218.005| System Binary Proxy Execution: Mshta | https://attack.mitre.org/techniques/T1218/005/ | #### Description This query lists all mshta executions, or if mshta is used legitimately can be used to filter on suspicious mshta child processes. #### Risk Threat actors can use mshta to drop payloads on systems. #### References - https://redcanary.com/threat-detection-report/techniques/mshta/ ## Defender XDR ```KQL let SuspiciousChildProcesses = dynamic(['cmd.exe', 'powershell.exe', 'bash.exe', 'csscript.exe', 'mshta.exe', 'msiexec.exe', 'rundll32.exe']); DeviceProcessEvents | where InitiatingProcessFileName =~ 'mshta.exe' or ProcessVersionInfoOriginalFileName =~ 'mshta.exe' // Optionally only list suspicious child processes //| where FileName in~ (SuspiciousChildProcesses) | project-reorder Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessCommandLine, AccountUpn, ProcessVersionInfoOriginalFileName ``` ## Sentinel ```KQL let SuspiciousChildProcesses = dynamic(['cmd.exe', 'powershell.exe', 'bash.exe', 'csscript.exe', 'mshta.exe', 'msiexec.exe', 'rundll32.exe']); DeviceProcessEvents | where InitiatingProcessFileName =~ 'mshta.exe' or ProcessVersionInfoOriginalFileName =~ 'mshta.exe' // Optionally only list suspicious child processes //| where FileName in~ (SuspiciousChildProcesses) | project-reorder TimeGenerated, DeviceName, ProcessCommandLine, InitiatingProcessCommandLine, AccountUpn, ProcessVersionInfoOriginalFileName ```
This query is designed to identify and list all instances where the mshta.exe process is executed on a system. mshta.exe is a legitimate Windows utility that can be exploited by threat actors to execute malicious scripts or payloads. The query is part of a security monitoring strategy to detect potential misuse of this utility.
mshta.exe and identify potentially suspicious activity.mshta.exe for proxy execution.mshta.exe to deploy harmful payloads on a system.mshta.exe and can be refined to focus on suspicious child processes, such as cmd.exe, powershell.exe, and others.This query can be used in both Microsoft Defender XDR and Microsoft Sentinel environments to enhance threat detection capabilities.

Bert-Jan Pals
Released: December 22, 2025
Tables
Keywords
Operators