Msiexec.exe Loads a DLL and Calls DllUnregisterServer via /z

Alert when msiexec.exe runs with -z and a .dll on the command line, consistent with DLL DllUnregisterServer execution.

FreeReviewedSigma · Medium · v4
Product
windows
Category
process_creation
Author
frack113 (SigmaHQ), DRL 1.1
Published
2022-04-24
Updated
2026-10-21
title: Msiexec.exe Loads a DLL and Calls DllUnregisterServer via /z
id: 0b05c0a9-2930-4b6e-84c4-ba8d73f4f012
status: test
description: This rule identifies executions where msiexec.exe loads a DLL and the command-line indicates use of the /z option together with a .dll argument. It matters because invoking DLL entry-point style functionality through installer components can be used for stealthy code execution. The detection relies on Windows process creation telemetry, matching msiexec.exe in image/original filename and filtering on specific command-line patterns.
references:
  - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1218.007/T1218.007.md
  - https://lolbas-project.github.io/lolbas/Binaries/Msiexec/
  - https://twitter.com/_st0pp3r_/status/1583914515996897281
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_msiexec_dll.yml
author: frack113, Huntrule Team
date: 2022-04-24
modified: 2026-10-19
tags:
  - attack.stealth
  - attack.t1218.007
logsource:
  product: windows
  category: process_creation
detection:
  selection_img:
    - Image|endswith: \msiexec.exe
    - OriginalFileName: \msiexec.exe
  selection_cli:
    CommandLine|contains|windash: " -z "
    CommandLine|contains: .dll
  filter_optional_msihandler:
    CommandLine|endswith: \MsiExec.exe" /Z "C:\Windows\CCM\MsiHandler.dll"
  condition: all of selection_* and not 1 of filter_optional_*
falsepositives:
  - Unknown
level: medium
regression_tests_path: regression_data/rules/windows/process_creation/proc_creation_win_msiexec_dll/info.yml
license: DRL-1.1
related:
  - id: 84f52741-8834-4a8c-a413-2eb2269aa6c8
    type: derived