Skip to content
Threat Feed
high advisory

Remotely Hosted HTA Execution via Mshta.exe

Adversaries utilize the legitimate Windows mshta.exe utility to execute remote malicious HTA files, bypassing security controls by fetching code directly from web-based infrastructure.

The Microsoft HTML Application host (mshta.exe) is a built-in Windows utility designed to execute .hta files. Threat actors frequently abuse this binary to execute arbitrary code by pointing it to a remotely hosted malicious file via HTTP, HTTPS, or FTP protocols. This technique allows attackers to load malicious payloads into memory, evading traditional file-based detection mechanisms. By executing scripts directly from a URL, the attacker minimizes the local file footprint, facilitating stealthy initial access or lateral movement. Defenders should monitor for mshta.exe command-line arguments that include remote URI schemes, as this behavior is rarely observed in standard administrative or user activity.

Attack Chain

  1. Attacker stages a malicious HTA file on an internet-facing web server or compromised infrastructure.
  2. The victim is lured into interacting with a malicious link or a document containing a trigger command.
  3. The trigger initiates the execution of 'mshta.exe' via command line, shell link, or another script.
  4. 'mshta.exe' makes an outbound HTTP/HTTPS request to the attacker-controlled URI to fetch the HTA payload.
  5. The HTA application engine parses the returned content, which contains embedded VBScript or JScript.
  6. The script executes within the context of the mshta process, potentially spawning child processes like 'powershell.exe' or 'cmd.exe'.
  7. The attacker achieves code execution to establish persistence, exfiltrate data, or deploy secondary malware.

Impact

Successful exploitation leads to full code execution within the security context of the user, potentially resulting in complete system compromise, the deployment of ransomware, or long-term unauthorized access to the network.

Recommendation

Deploy the provided Sigma detection rule to flag instances where mshta.exe is invoked with remote URI parameters. Configure EDR or logging solutions to monitor process creation events and block outbound network connections from mshta.exe to unknown or untrusted external domains.


Immediate actions

Deploy Sigma rule to monitor for mshta.exe with network-based arguments

Detection Engineering 48h

Threat Hunt

Search historical logs for mshta.exe command lines containing http, https, or ftp

T1218.005 high high confidence hunt now

Data: Process creation logs

Mitigations

Restrict mshta.exe network access via host-based firewall if not required for business operations

medium_term IT Operations

T1218.005

Detection coverage 1

Detect Remotely Hosted HTA Execution via Mshta.exe

high

Detects execution of the mshta utility with an argument containing web-based protocols, which indicates the execution of a remotely hosted malicious HTA file.

sigma tactics: execution techniques: T1218.005 sources: process_creation, windows

Detection queries are available on the platform. Get full rules →