Detection rules › Sigma

PowerShell Module File Created By Non-PowerShell Process

Status
test
Severity
medium
Log source
product windows, category file_event
Author
Nasreddine Bencherchali (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects the creation of a new PowerShell module ".psm1", ".psd1", ".dll", ".ps1", etc. by a non-PowerShell process

MITRE ATT&CK coverage

TacticTechniques
PersistenceNo specific technique

Event coverage

ProviderEventTitle
SysmonEvent ID 11FileCreate

Rule body yaml

title: PowerShell Module File Created By Non-PowerShell Process
id: e3845023-ca9a-4024-b2b2-5422156d5527
status: test
description: Detects the creation of a new PowerShell module ".psm1", ".psd1", ".dll", ".ps1", etc. by a non-PowerShell process
references:
    - Internal Research
    - https://learn.microsoft.com/en-us/powershell/scripting/developer/module/understanding-a-windows-powershell-module?view=powershell-7.3
author: Nasreddine Bencherchali (Nextron Systems)
date: 2023-05-09
modified: 2025-10-07
tags:
    - attack.persistence
logsource:
    category: file_event
    product: windows
detection:
    selection:
        TargetFilename|contains:
            - '\WindowsPowerShell\Modules\'
            - '\PowerShell\7\Modules\'
    filter_main_pwsh:
        Image|endswith:
            - ':\Program Files\PowerShell\7-preview\pwsh.exe'
            - ':\Program Files\PowerShell\7\pwsh.exe'
            - ':\Windows\System32\poqexec.exe' # https://github.com/SigmaHQ/sigma/issues/4448
            - ':\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe'
            - ':\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
            - ':\Windows\SysWOW64\poqexec.exe' # https://github.com/SigmaHQ/sigma/issues/4448
            - ':\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell_ise.exe'
            - ':\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe'
    filter_main_msiexec:
        Image:
            - 'C:\Windows\System32\msiexec.exe'
            - 'C:\Windows\SysWOW64\msiexec.exe'
    condition: selection and not 1 of filter_main_*
falsepositives:
    - Unknown
level: medium

Stages and Predicates

Stage 0: condition

selection and not 1 of filter_main_*

Stage 1: selection

selection:
    TargetFilename|contains:
        - '\WindowsPowerShell\Modules\'
        - '\PowerShell\7\Modules\'

Stage 2: not filter_main_*

filter_main_pwsh:
    Image|endswith:
        - ':\Program Files\PowerShell\7-preview\pwsh.exe'
        - ':\Program Files\PowerShell\7\pwsh.exe'
        - ':\Windows\System32\poqexec.exe'
        - ':\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe'
        - ':\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
        - ':\Windows\SysWOW64\poqexec.exe'
        - ':\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell_ise.exe'
        - ':\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe'
filter_main_msiexec:
    Image:
        - 'C:\Windows\System32\msiexec.exe'
        - 'C:\Windows\SysWOW64\msiexec.exe'

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
Imageends_with:\Program Files\PowerShell\7-preview\pwsh.exe
Imageends_with:\Program Files\PowerShell\7\pwsh.exe
Imageends_with:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
Imageends_with:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell_ise.exe
Imageends_with:\Windows\SysWOW64\poqexec.exe
Imageends_with:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Imageends_with:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe
Imageends_with:\Windows\System32\poqexec.exe
ImageeqC:\Windows\SysWOW64\msiexec.exe
ImageeqC:\Windows\System32\msiexec.exe

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
TargetFilenamematch
  • \PowerShell\7\Modules\ corpus 2 (sigma 2)
  • \WindowsPowerShell\Modules\ corpus 2 (sigma 2)