Sigma rule: Import PowerShell Modules From Suspicious Directories

A detection rule from the SigmaHQ repository, shown as its author published it. Dataset version ref-87df241906d8, updated 2023-01-10T00:00:00.000Z.

Rule

Title
Import PowerShell Modules From Suspicious Directories
Status
test
Level
medium
Author
Nasreddine Bencherchali (Nextron Systems)
Date
2022-07-07
Modified
2023-01-10
File
rules/windows/powershell/powershell_script/posh_ps_import_module_susp_dirs.yml
Commit
ccbb0369507f796db0b0ae6854c8a2be471b9d84

Detects powershell scripts that import modules from suspicious directories

Log source

product
windows
category
ps_script
definition
Requirements: Script Block Logging must be enabled

Detection

selection:
    ScriptBlockText|contains:
        - 'Import-Module "$Env:Temp\'
        - Import-Module '$Env:Temp\
        - 'Import-Module $Env:Temp\'
        - 'Import-Module "$Env:Appdata\'
        - Import-Module '$Env:Appdata\
        - 'Import-Module $Env:Appdata\'
        - 'Import-Module C:\Users\Public\'
        # Import-Module alias is "ipmo"
        - 'ipmo "$Env:Temp\'
        - ipmo '$Env:Temp\
        - 'ipmo $Env:Temp\'
        - 'ipmo "$Env:Appdata\'
        - ipmo '$Env:Appdata\
        - 'ipmo $Env:Appdata\'
        - 'ipmo C:\Users\Public\'
condition: selection

False positives (as the rule lists them)

  • Unknown

Tags

  • attack.execution
  • attack.t1059.001

MITRE ATT&CK ids this rule names

Related rules

References

Read on 2026-11-03T00:58:21.399Z under licence sigma-drl-1.1@d5f4c36a from https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules/windows/powershell/powershell_script/posh_ps_import_module_susp_dirs.yml

Sources and licences

  • SigmaHQ

    "Import PowerShell Modules From Suspicious Directories" by Nasreddine Bencherchali (Nextron Systems) (SigmaHQ). Rule: https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules/windows/powershell/powershell_script/posh_ps_import_module_susp_dirs.yml.
    Licensed under the Detection Rule License (DRL) 1.1: https://github.com/SigmaHQ/Detection-Rule-License

    Detection Rule License (DRL) 1.1

Cite this page

Dragons Eye Ransomware Tracker, "Sigma rule: Import PowerShell Modules From Suspicious Directories",
entity page, dataset version ref-87df241906d8, updated 2023-01-10T00:00:00.000Z,
https://ransomware-tracker.com/detections/sigma/21f9162c-5f5d-4b01-89a8-b705bd7d10ab (accessed 2026-11-03).
Underlying source: SigmaHQ rule 21f9162c-5f5d-4b01-89a8-b705bd7d10ab, commit ccbb0369507f796db0b0ae6854c8a2be471b9d84.

Pages change. The dataset version identifies the data, but no archive of old versions is kept, so this citation cannot be replayed later.