Windows Process Creation: PowerShell Import-Module from Temp/AppData/Public Paths
Alerts on PowerShell Import-Module calls that load modules from Temp, AppData, or Public directories on Windows.
FreeUnreviewedSigmamediumv1
windows-process-creation-powershell-import-module-from-temp-appdata-public-paths-c31364f7
title: "Windows Process Creation: PowerShell Import-Module from Temp/AppData/Public Paths"
id: 6746cacf-9dcc-4ef9-8845-f940b48febbc
related:
- id: 21f9162c-5f5d-4b01-89a8-b705bd7d10ab
type: similar
- id: c31364f7-8be6-4b77-8483-dd2b5a7b69a3
type: derived
status: test
description: This rule flags Windows process creation events where the PowerShell command line includes Import-Module (or ipmo) referencing module paths under $Env:Temp, $Env:Appdata, or C:\Users\Public. Attackers often import modules from writable or user-accessible locations to run attacker-controlled code and evade straightforward script inspection. Telemetry relies on process creation logging that captures the full PowerShell command line.
references:
- https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1003.002/T1003.002.md
- https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_powershell_import_module_susp_dirs.yml
author: Nasreddine Bencherchali (Nextron Systems), Huntrule Team
date: 2023-01-10
tags:
- attack.execution
- attack.t1059.001
logsource:
category: process_creation
product: windows
detection:
selection:
CommandLine|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\
- ipmo "$Env:Temp\
- ipmo '$Env:Temp\
- ipmo $Env:Temp\
- ipmo "$Env:Appdata\
- ipmo '$Env:Appdata\
- ipmo $Env:Appdata\
- ipmo C:\Users\Public\
condition: selection
falsepositives:
- Unknown
level: medium
license: DRL-1.1
What it detects
This rule flags Windows process creation events where the PowerShell command line includes Import-Module (or ipmo) referencing module paths under $Env:Temp, $Env:Appdata, or C:\Users\Public. Attackers often import modules from writable or user-accessible locations to run attacker-controlled code and evade straightforward script inspection. Telemetry relies on process creation logging that captures the full PowerShell command line.
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.