Detection rules › Sigma

Suspicious Autorun Registry Modified via WMI

Status
experimental
Severity
high
Log source
category process_creation, product windows
Author
Swachchhanda Shrawan Poudel (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects suspicious activity where the WMIC process is used to create an autorun registry entry via reg.exe, which is often indicative of persistence mechanisms employed by malware.

Known false positives

  • Legitimate administrative activity or software installations

MITRE ATT&CK coverage

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 1: Process creation

Rule body

title: Suspicious Autorun Registry Modified via WMI
id: c80e66d8-1780-48a9-b412-46663fd21ac0
status: experimental
description: |
    Detects suspicious activity where the WMIC process is used to create an autorun registry entry via reg.exe, which is often indicative of persistence mechanisms employed by malware.
references:
    - Internal Research
    - https://github.com/HackTricks-wiki/hacktricks/blob/e4c7b21b8f36c97c35b7c622732b38a189ce18f7/src/windows-hardening/windows-local-privilege-escalation/privilege-escalation-with-autorun-binaries.md
author: Swachchhanda Shrawan Poudel (Nextron Systems)
date: 2025-02-17
tags:
    - attack.privilege-escalation
    - attack.execution
    - attack.persistence
    - attack.t1547.001
    - attack.t1047
logsource:
    category: process_creation
    product: windows
detection:
    selection_execution_img:
        - Image|endswith: '\wmic.exe'
        - OriginalFileName: 'wmic.exe' # wmic process call create 'reg.exe add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run /v Desktops /t REG_SZ /d "\"C:\Users\user\AppData\Roaming\Microsoft\tre\Desktops.exe\" random" /f'
        - ParentImage|endswith: '\wmiprvse.exe'
    selection_execution_cmd:
        CommandLine|contains|all:
            - 'reg'
            - ' add '
        CommandLine|contains:
            - '\Software\Microsoft\Windows\CurrentVersion\Run'
            - '\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run'
            - '\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run'
    selection_suspicious_paths_1:
        CommandLine|contains:
            - ':\Perflogs'
            - :\ProgramData'
            - ':\Windows\Temp'
            - ':\Temp'
            - '\AppData\Local\Temp'
            - '\AppData\Roaming'
            - ':\$Recycle.bin'
            - ':\Users\Default'
            - ':\Users\public'
            - '%temp%'
            - '%tmp%'
            - '%Public%'
            - '%AppData%'
    selection_suspicious_paths_user_1:
        CommandLine|contains: ':\Users\'
    selection_suspicious_paths_user_2:
        CommandLine|contains:
            - '\Favorites'
            - '\Favourites'
            - '\Contacts'
            - '\Music'
            - '\Pictures'
            - '\Documents'
            - '\Photos'
    condition: all of selection_execution_* and (selection_suspicious_paths_1 or (all of selection_suspicious_paths_user_*))
falsepositives:
    - Legitimate administrative activity or software installations
level: high

Stages and Predicates

Stage 0: condition

all of selection_execution_* and (selection_suspicious_paths_1 or (all of selection_suspicious_paths_user_*))

Stage 1: selection_execution_img

selection_execution_img:
    - Image|endswith: '\wmic.exe'
    - OriginalFileName: 'wmic.exe'
    - ParentImage|endswith: '\wmiprvse.exe'

Stage 2: selection_execution_cmd

selection_execution_cmd:
    CommandLine|contains|all:
        - 'reg'
        - ' add '
    CommandLine|contains:
        - '\Software\Microsoft\Windows\CurrentVersion\Run'
        - '\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run'
        - '\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run'

Stage 3: selection_suspicious_paths_1

selection_suspicious_paths_1:
    CommandLine|contains:
        - ':\Perflogs'
        - :\ProgramData'
        - ':\Windows\Temp'
        - ':\Temp'
        - '\AppData\Local\Temp'
        - '\AppData\Roaming'
        - ':\$Recycle.bin'
        - ':\Users\Default'
        - ':\Users\public'
        - '%temp%'
        - '%tmp%'
        - '%Public%'
        - '%AppData%'

Stage 4: selection_suspicious_paths_user_1

selection_suspicious_paths_user_1:
    CommandLine|contains: ':\Users\'

Stage 5: selection_suspicious_paths_user_2

selection_suspicious_paths_user_2:
    CommandLine|contains:
        - '\Favorites'
        - '\Favourites'
        - '\Contacts'
        - '\Music'
        - '\Pictures'
        - '\Documents'
        - '\Photos'

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
CommandLinematch
  • add corpus 15 (sigma 13, splunk 1, chronicle 1)
  • %AppData% corpus 13 (sigma 11, chronicle 2)
  • %Public% corpus 7 (sigma 5, chronicle 2)
  • %temp% corpus 16 (sigma 13, chronicle 2, kusto 1)
  • %tmp% corpus 15 (sigma 13, chronicle 2)
  • :\$Recycle.bin corpus 2 (sigma 1, kusto 1)
  • :\Perflogs corpus 3 (sigma 3)
  • :\ProgramData'
  • :\Temp
  • :\Users\ corpus 6 (sigma 6)
  • :\Users\Default
  • :\Users\public corpus 2 (sigma 2)
  • :\Windows\Temp corpus 2 (sigma 2)
  • \AppData\Local\Temp corpus 8 (sigma 8)
  • \AppData\Roaming
  • \Contacts
  • \Documents
  • \Favorites
  • \Favourites
  • \Music
  • \Photos
  • \Pictures
  • \Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run corpus 3 (sigma 3)
  • \Software\Microsoft\Windows\CurrentVersion\Run corpus 3 (sigma 3)
  • \Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run corpus 3 (sigma 3)
  • reg corpus 7 (sigma 5, splunk 1, kusto 1)
field:"CommandLine" kind:match
Imageends_with
  • \wmic.exe corpus 62 (sigma 62)
field:"Image" kind:ends_with value:"\wmic.exe"
OriginalFileNameeq
  • wmic.exe corpus 80 (sigma 38, elastic 24, splunk 18)
field:"OriginalFileName" kind:eq value:"wmic.exe"
ParentImageends_with
  • \wmiprvse.exe corpus 8 (sigma 8)
field:"ParentImage" kind:ends_with value:"\wmiprvse.exe"