MsiExec DllUnregisterServer execution
Adversaries may abuse the legitimate msiexec.exe binary to execute arbitrary code contained within a DLL by invoking the DllUnregisterServer function.
Triage facts
Revision 1- Applicability
- Windows
- Evidence
- Unknown
- Severity
- Medium
- Action
- Elevated
- Sources
- 3 public sources
- Freshness
- Revision 1Oct 21, 00:48 UTC
- Detection
- 1 rule
- Source quality
- B2Likely
The Windows Installer utility (msiexec.exe) is a signed, legitimate binary used for installing and configuring software. Attackers can leverage the "/Z" flag to load a specified DLL and call its exported "DllUnregisterServer" function. This technique is often used to bypass security controls or execute malicious code in the context of a trusted process. Because this behavior is atypical for standard administrative tasks outside of specific update or maintenance workflows, it serves as a high-fidelity indicator of potential malicious activity. Defenders should monitor process command lines for the use of the "/Z" parameter in conjunction with external DLL references.
Attack Chain
- Attacker crafts a malicious DLL file containing a payload within the DllUnregisterServer exported function.
- The DLL is staged on the target system, typically in a directory where the user or service has write permissions.
- Attacker identifies the msiexec.exe utility, a native Windows component.
- Attacker executes msiexec.exe via command line using the "/Z" flag.
- The command line specifies the full path to the malicious DLL as the argument for the "/Z" parameter.
- MsiExec initializes and loads the attacker-supplied DLL into its memory space.
- MsiExec calls the DllUnregisterServer function within the loaded DLL.
- The payload executes, potentially resulting in secondary malware deployment, C2 communication, or lateral movement.
Impact
Successful exploitation allows for execution of arbitrary code in the context of the msiexec.exe process, potentially bypassing application allowlisting and leveraging the trusted reputation of the Windows Installer binary.
Recommendation
Deploy the provided Sigma rule to detect suspicious msiexec.exe invocations. Audit legitimate software installers or update agents in the environment that may utilize the "/Z" flag and include them in the filter logic of the detection rule.
Immediate actions
Deploy Sigma rule to detect anomalous msiexec /z usage
Threat Hunt
Search for process creation events of msiexec.exe with /z and .dll in the command line
Data: process_creation
Detection coverage 1
Detect DllUnregisterServer execution via MsiExec
mediumDetects MsiExec loading a DLL and calling its DllUnregisterServer function using the /Z flag
Detection queries are available on the platform. Get full rules →