Script Execution via Microsoft HTML Application
Detects the execution of scripts via HTML applications using Windows utilities rundll32.exe or mshta.exe to bypass defenses by proxying execution of malicious content with signed binaries.
This detection identifies the execution of scripts via HTML applications, leveraging Windows utilities like rundll32.exe or mshta.exe. Attackers often use this method to bypass process and signature-based defenses by proxying the execution of malicious content through legitimate, signed binaries. The detection focuses on specific command-line arguments and patterns associated with this technique, while also excluding known legitimate uses by applications such as Citrix System32 (wfshell.exe), Microsoft Access (MSACCESS.EXE), and Quokka.Works (GTInstaller.exe). This technique is used by attackers to execute malicious scripts without directly running them, thus evading traditional security measures. The detection rule analyzes process names, command-line arguments, parent processes, and file paths to identify potentially malicious activity indicative of defense evasion.
Attack Chain
- An attacker gains initial access through various means (e.g., phishing, drive-by download).
- The attacker leverages a malicious HTML application (HTA) file or a scriptlet (SCT) file.
- The attacker uses
mshta.exeorrundll32.exeto execute the malicious HTA or SCT file. The command line includes obfuscated or encoded script content. mshta.exeorrundll32.exeprocess spawns a child process, such ascmd.exeorpowershell.exe, to execute further commands.- The spawned process executes malicious code, such as downloading and executing a payload.
- The attacker achieves persistence by modifying registry keys or creating scheduled tasks.
- The attacker performs lateral movement by exploiting vulnerabilities or using stolen credentials.
- The final objective is achieved, such as data exfiltration, ransomware deployment, or system compromise.
Impact
Successful exploitation can lead to arbitrary code execution, allowing attackers to compromise the system, steal sensitive data, deploy ransomware, or establish a persistent foothold. Due to the nature of the technique, it can bypass many traditional security measures. The wide adoption of Windows and the inherent trust placed in signed binaries makes this a potent evasion technique. Failure to detect and prevent this attack can lead to significant financial and reputational damage for the targeted organization.
Recommendation
- Deploy the Sigma rule “Script Execution via Microsoft HTML Application” to your SIEM to detect suspicious
mshta.exeandrundll32.exeexecutions. Tune the rule by adding exceptions for known legitimate uses in your environment. - Enable Sysmon process creation logging (Event ID 1) to ensure the visibility required for the Sigma rules to function correctly.
- Monitor process command lines for suspicious arguments like “script:eval”, “WScript.Shell”, and “mshta http” which are indicative of this technique.
- Implement application control policies to restrict the execution of
mshta.exeandrundll32.exewhere they are not required for legitimate business purposes. - Investigate and block any identified malicious HTA files or scriptlet URLs found in the command lines of detected processes.
Detection coverage 3
Script Execution via Microsoft HTML Application
highDetects the execution of scripts via HTML applications using Windows utilities rundll32.exe or mshta.exe with suspicious command line arguments.
Suspicious MSHTA Execution without HTA/HTM File
mediumDetects mshta.exe execution without .hta or .htm file arguments, and with a high number of arguments.
MSHTA Execution from Archive or Temp Directory
mediumDetects mshta.exe execution from common archive extraction or temporary directories.
Detection queries are kept inside the platform. Get full rules →