Windows msiexec.exe Command Line Loading a DLL and Calling DllUnregisterServer

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

FreeUnreviewedSigmamediumv1
title: Windows msiexec.exe Command Line Loading a DLL and Calling DllUnregisterServer
id: 0b05c0a9-2930-4b6e-84c4-ba8d73f4f012
status: test
description: This rule flags process creation events where msiexec.exe is executed with arguments indicating the -z option and includes a .dll path in the command line. It is consistent with a technique where msiexec loads a DLL and invokes its DllUnregisterServer functionality, which can support stealthy execution by abusing legitimate installer behavior. The detection relies on process creation telemetry capturing msiexec.exe identification and the raw command line contents.
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: 2024-03-13
tags:
  - attack.stealth
  - attack.t1218.007
logsource:
  product: windows
  category: process_creation
detection:
  selection_img:
    - Image|endswith: \msiexec.exe
    - OriginalFileName: \msiexec.exe
  selection_flag:
    CommandLine|contains|windash: " -z "
  selection_dll:
    CommandLine|contains: .dll
  condition: all of selection_*
falsepositives:
  - Unknown
level: medium
license: DRL-1.1
related:
  - id: 84f52741-8834-4a8c-a413-2eb2269aa6c8
    type: derived

What it detects

This rule flags process creation events where msiexec.exe is executed with arguments indicating the -z option and includes a .dll path in the command line. It is consistent with a technique where msiexec loads a DLL and invokes its DllUnregisterServer functionality, which can support stealthy execution by abusing legitimate installer behavior. The detection relies on process creation telemetry capturing msiexec.exe identification and the raw command line contents.

Known false positives

  • Unknown

Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.