Skip to content
Threat Feed
high advisory

Detection of Suspicious PowerShell Encoded Command Patterns

This detection brief identifies common malicious PowerShell command line patterns that utilize Base64 encoded arguments frequently observed in malware infection stages.

This brief addresses the prevalence of PowerShell encoded commands within malicious infection chains. Threat actors frequently leverage Base64 encoding to obfuscate command line arguments, thereby bypassing static signature-based detection mechanisms. The patterns identified in this detection logic specifically target common Base64-encoded strings that trigger execution or facilitate further payload download, such as "IEX" (Invoke-Expression) or "DownloadString" variations. These commands are often observed in the initial stages of a breach, such as dropper execution or lateral movement scripts. Detecting these patterns is essential for identifying early-stage attacker activity where attackers attempt to hide the intent of their PowerShell execution. Defenders should focus on process creation telemetry from endpoints to distinguish legitimate administrative tasks from these malicious patterns.

Impact

Successful exploitation allows attackers to execute arbitrary code with the permissions of the compromised user account. This provides a foothold for further malicious activities, including credential harvesting, lateral movement across the network, and the deployment of ransomware or exfiltration tools. If left undetected, this activity leads to full system compromise.

Recommendation

  • Deploy the provided Sigma rule to your SIEM to monitor for encoded PowerShell command lines.
  • Baseline existing administrative scripts to identify potential false positives and tune the detection by filtering known-good parent processes or scripts.
  • Enable Sysmon or equivalent process-creation logging (Event ID 1) across all Windows endpoints to capture full command line arguments.
  • Investigate any high-confidence alerts generated by this rule to determine if the activity originates from legitimate system administration or an unauthorized script.

Immediate actions

Deploy the Sigma rule to the SIEM and enable monitoring for encoded PowerShell flags

Detection Engineering 48h

Threat Hunt

Search for encoded patterns in existing command line logs

T1059.001 high high confidence hunt now

Data: CommandLine logs

Detection coverage 1

Detect Suspicious PowerShell Encoded Command Patterns

high

Detects PowerShell command line patterns in combination with encoded commands that often appear in malware infection chains

sigma tactics: execution techniques: T1059.001 sources: process_creation, windows

Detection queries are available on the platform. Get full rules →