Skip to content
Threat Feed
medium advisory

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

  1. Attacker crafts a malicious DLL file containing a payload within the DllUnregisterServer exported function.
  2. The DLL is staged on the target system, typically in a directory where the user or service has write permissions.
  3. Attacker identifies the msiexec.exe utility, a native Windows component.
  4. Attacker executes msiexec.exe via command line using the "/Z" flag.
  5. The command line specifies the full path to the malicious DLL as the argument for the "/Z" parameter.
  6. MsiExec initializes and loads the attacker-supplied DLL into its memory space.
  7. MsiExec calls the DllUnregisterServer function within the loaded DLL.
  8. 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

Detection Engineering 48h

Threat Hunt

Search for process creation events of msiexec.exe with /z and .dll in the command line

T1218.007 medium medium confidence hunt now

Data: process_creation

Detection coverage 1

Detect DllUnregisterServer execution via MsiExec

medium

Detects MsiExec loading a DLL and calling its DllUnregisterServer function using the /Z flag

sigma tactics: stealth techniques: T1218.007 sources: process_creation, windows

Detection queries are available on the platform. Get full rules →