Import New Module Via PowerShell CommandLine
Description
Detects usage of the "Import-Module" cmdlet in order to add new Cmdlets to the current PowerShell session
Query · sigma
selection_img: - Image|endswith: - \powershell.exe - \pwsh.exe - OriginalFileName: - PowerShell.EXE - pwsh.dll selection_cmdlet: CommandLine|contains: - 'Import-Module ' - 'ipmo ' filter_main_vsstudio: ParentImage|contains: - :\Program Files\WindowsApps\Microsoft.WindowsTerminal_ - :\Windows\System32\cmd.exe CommandLine|contains|all: - :\Program Files\Microsoft Visual Studio\ - Tools\Microsoft.VisualStudio.DevShell.dll condition: all of selection_* and not 1 of filter_main_*
Known false positives
- Depending on the environement, many legitimate scripts will import modules inline. This rule is targeted for hunting purposes.