Detection rules › Sigma
Potentially Suspicious Mofcomp Execution
Detects execution of the "mofcomp" utility as a child of a suspicious shell or script running utility or by having a suspicious path in the commandline. The "mofcomp" utility parses a file containing MOF statements and adds the classes and class instances defined in the file to the WMI repository. Attackers abuse this utility to install malicious MOF scripts
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Telemetry coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
Rule body
title: Potentially Suspicious Mofcomp Execution
id: 1dd05363-104e-4b4a-b963-196a534b03a1
status: test
description: |
Detects execution of the "mofcomp" utility as a child of a suspicious shell or script running utility or by having a suspicious path in the commandline.
The "mofcomp" utility parses a file containing MOF statements and adds the classes and class instances defined in the file to the WMI repository.
Attackers abuse this utility to install malicious MOF scripts
references:
- https://thedfirreport.com/2022/07/11/select-xmrig-from-sqlserver/
- https://github.com/The-DFIR-Report/Sigma-Rules/blob/75260568a7ffe61b2458ca05f6f25914efb44337/win_mofcomp_execution.yml
- https://learn.microsoft.com/en-us/windows/win32/wmisdk/mofcomp
author: Nasreddine Bencherchali (Nextron Systems)
date: 2022-07-12
modified: 2026-08-06
tags:
- attack.stealth
- attack.t1218
logsource:
category: process_creation
product: windows
detection:
selection_img:
- Image|endswith: '\mofcomp.exe'
- OriginalFileName: 'mofcomp.exe'
selection_case:
- ParentImage|endswith:
- '\cmd.exe'
- '\powershell.exe'
- '\pwsh.exe'
- '\wsl.exe'
- '\wscript.exe'
- '\cscript.exe'
- CommandLine|contains:
- '\AppData\Local\Temp'
- '\Contacts\'
- '\Favorites\'
- '\Favourites\'
- '\Music\'
- '\Pictures\'
- '\Users\Public\'
- '\Videos\'
- '\WINDOWS\Temp\'
- '%appdata%'
- '%temp%'
- '%tmp%'
filter_main_wmiprvse:
ParentImage: 'C:\Windows\System32\wbem\WmiPrvSE.exe'
CommandLine|contains: 'C:\Windows\TEMP\'
CommandLine|endswith: '.mof'
filter_main_installutil:
ParentCommandLine|endswith: '\InstallUtil.exe /Uninstall C:\Windows\CCM\Microsoft.ConfigurationManager.SVProvider.dll'
ParentImage|endswith: '\InstallUtil.exe'
CommandLine|contains|all:
- 'C:\Windows\TEMP'
- '.tmp'
filter_optional_null_parent:
ParentCommandLine: null
condition: all of selection_* and not 1 of filter_main_* and not 1 of filter_optional_*
falsepositives:
- Unknown
level: high
Stages and Predicates
Stage 0: condition
all of selection_* and not 1 of filter_main_* and not 1 of filter_optional_*Stage 1: selection_img
selection_img:
- Image|endswith: '\mofcomp.exe'
- OriginalFileName: 'mofcomp.exe'
Stage 2: selection_case
selection_case:
- ParentImage|endswith:
- '\cmd.exe'
- '\powershell.exe'
- '\pwsh.exe'
- '\wsl.exe'
- '\wscript.exe'
- '\cscript.exe'
- CommandLine|contains:
- '\AppData\Local\Temp'
- '\Contacts\'
- '\Favorites\'
- '\Favourites\'
- '\Music\'
- '\Pictures\'
- '\Users\Public\'
- '\Videos\'
- '\WINDOWS\Temp\'
- '%appdata%'
- '%temp%'
- '%tmp%'
Stage 3: not filter_main_*
filter_main_wmiprvse:
ParentImage: 'C:\Windows\System32\wbem\WmiPrvSE.exe'
CommandLine|contains: 'C:\Windows\TEMP\'
CommandLine|endswith: '.mof'
filter_main_installutil:
ParentCommandLine|endswith: '\InstallUtil.exe /Uninstall C:\Windows\CCM\Microsoft.ConfigurationManager.SVProvider.dll'
ParentImage|endswith: '\InstallUtil.exe'
CommandLine|contains|all:
- 'C:\Windows\TEMP'
- '.tmp'
Stage 4: not filter_optional_null_parent
filter_optional_null_parent:
ParentCommandLine: null
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
CommandLine | ends_with | .mof | excludes:CommandLine field:"CommandLine" value:".mof" |
CommandLine | match | C:\Windows\TEMP\ | excludes:CommandLine field:"CommandLine" value:"C:\Windows\TEMP\" |
ParentImage | eq | C:\Windows\System32\wbem\WmiPrvSE.exe | excludes:ParentImage field:"ParentImage" value:"C:\Windows\System32\wbem\WmiPrvSE.exe" |
CommandLine | match | .tmp | excludes:CommandLine field:"CommandLine" value:".tmp" |
CommandLine | match | C:\Windows\TEMP | excludes:CommandLine field:"CommandLine" value:"C:\Windows\TEMP" |
ParentCommandLine | ends_with | \InstallUtil.exe /Uninstall C:\Windows\CCM\Microsoft.ConfigurationManager.SVProvider.dll | excludes:ParentCommandLine field:"ParentCommandLine" value:"\InstallUtil.exe /Uninstall C:\Windows\CCM\Microsoft.ConfigurationManager.SVProvider.dll" |
ParentImage | ends_with | \InstallUtil.exe | excludes:ParentImage field:"ParentImage" value:"\InstallUtil.exe" |
ParentCommandLine | is_null | excludes:ParentCommandLine |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
CommandLine | match |
| field:"CommandLine" kind:match |
Image | ends_with |
| field:"Image" kind:ends_with value:"\mofcomp.exe" |
OriginalFileName | eq |
| field:"OriginalFileName" kind:eq value:"mofcomp.exe" |
ParentImage | ends_with |
| field:"ParentImage" kind:ends_with |