Import New Module Via PowerShell CommandLine

Last updated on:

About the rule

Rule Type

Standard

Rule Description

Detects usage of the "Import-Module" cmdlet in order to add new Cmdlets to the current PowerShell session

Severity

Attention

Rule Requirement

Criteria

Action1: actionname = "Process started" AND ((PROCESSNAME endswith "\powershell.exe,\pwsh.exe" OR ORIGINALFILENAME = "PowerShell.EXE,pwsh.dll") AND COMMANDLINE contains "Import-Module ,ipmo ") AND (PARENTPROCESSNAME notcontains ":\Program Files\WindowsApps\Microsoft.WindowsTerminal_,:\Windows\System32\cmd.exe" OR (COMMANDLINE notcontains ":\Program Files\Microsoft Visual Studio" OR COMMANDLINE notcontains "Tools\Microsoft.VisualStudio.DevShell.dll")) select Action1.HOSTNAME,Action1.MESSAGE,Action1.COMMANDLINE,Action1.FILE_NAME,Action1.PROCESSNAME,Action1.USERNAME,Action1.PARENTPROCESSNAME

Detection

Execution Mode

realtime

Log Sources

Windows

Author

Nasreddine Bencherchali (Nextron Systems)