Overview
Theinstall action installs MSI (Microsoft Installer) packages on remote systems using the Win32_Product.Install WMI method. This enables remote software deployment without requiring interactive access.
Syntax
Parameters
| Parameter | Required | Description |
|---|---|---|
action | Yes | Must be install |
path | Yes | Path to MSI file (must be accessible from target) |
computername | No | Target host(s), comma-separated. Defaults to localhost |
amsi | No | Set to disable to bypass AMSI during installation |
username | No | Username for authentication |
password | No | Password for authentication |
Usage Examples
Basic MSI Installation
Example Output
0= Success- Non-zero = Error code (see troubleshooting)
Operational Scenarios
Scenario 1: Upload and Install Malicious MSI
Scenario 2: Network Share Deployment
Scenario 3: Lateral Movement via MSI
Scenario 4: Persistence Installation
Creating Malicious MSI Files
MSI Payload Creation
MSI Payload Creation
Using msfvenom:Using WiX Toolset:
Create custom MSI with embedded payloads using WiX Toolset for more sophisticated installations.Custom Actions:
MSI files support custom actions that execute during installation, providing opportunities for code execution.
MSI File Access
The MSI file must be accessible from the target system:- UNC Path
- Local Path
- HTTP URL
- No file upload needed
- Centralized deployment
- Legitimate-looking paths
- SMB access to share
- Target can resolve UNC path
- Appropriate permissions
AMSI Evasion
Whenamsi=disable is specified:
- Modifies registry:
HKCU\Software\Microsoft\Windows Script\Settings\AmsiEnable = 0 - Executes MSI installation
- Restores original AMSI setting
Remote vs Local Usage
- Local Installation
- Remote Installation
- Local testing
- Post-exploitation on compromised system
Detection Considerations
MSI Installation Detection
MSI Installation Detection
- Event ID 1033: MsiInstaller installation beginning
- Event ID 1034: MsiInstaller installation completion
- Event ID 4688: Process creation (msiexec.exe)
- Sysmon Event ID 1: msiexec.exe spawned by wmiprvse.exe
WMI Detection
WMI Detection
- Win32_Product.Install method invocation
- Event ID 5857: WMI activity
- Sysmon Event ID 19-21: WMI operations
- Remote WMI installation operations
File System Detection
File System Detection
- MSI file creation in suspicious locations
- Installation from temp directories
- UNC paths from unknown sources
- MSI files in user-writable locations
Behavioral Detection
Behavioral Detection
- Unsigned MSI installations
- MSI from non-standard locations
- Installations by non-administrative processes
- Installations outside change windows
Best Practices
MSI Preparation
- Code sign MSI if possible
- Use legitimate-looking metadata
- Test installation locally first
- Keep MSI size reasonable
Operational Security
- Always use
amsi=disable - Clean up MSI files after install
- Use UNC paths when possible
- Monitor for installation failures
Path Selection
- Use legitimate-looking paths
- Avoid temp directories if possible
- Consider Windows\Installer directory
- Match existing package paths
Post-Installation
- Verify installation succeeded
- Remove MSI file
- Check installed programs list
- Verify payload execution
Installation Options
Theinstall action uses default MSI installation options:
exec action with msiexec:
Troubleshooting
Product Install Returned: Non-Zero
Product Install Returned: Non-Zero
Cause: Installation failedCommon error codes:
1602: User cancelled installation1603: Fatal error during installation1619: Package could not be opened1625: Installation forbidden by policy
- Check MSI file is accessible
- Verify file is valid MSI
- Check for Group Policy restrictions
- Review installation logs
Access Denied
Access Denied
Cause: Insufficient privilegesSolution:
- Verify admin credentials
- Use
usernameandpasswordparameters - Check UAC remote restrictions
- Ensure user can install software
Package Not Found
Package Not Found
Cause: Path inaccessible from targetSolution:
- Verify UNC path is accessible
- Check SMB connectivity
- Upload file locally first
- Test path from target system
Installation Hangs
Installation Hangs
Cause: UI prompts or long installationSolution:
- Use silent installation options
- Increase timeout if possible
- Check for interactive prompts
- Use msiexec with /quiet flag
Verification
Verify MSI installation succeeded:Related Actions
upload
Upload MSI files before installation
exec
Execute msiexec with custom options
query
Verify installation
ps
Check for installed processes
Alternative Installation
Using msiexec Directly
Using msiexec Directly