Skip to content
Threat Feed
low advisory

Detection of PowerShell Alias Cmdlet Misuse for Obfuscation

Adversaries use Set-Alias and New-Alias cmdlets in PowerShell to rename standard commands, obfuscating malicious scripts to bypass security monitoring and automated analysis.

Threat actors frequently employ PowerShell obfuscation techniques to conceal their intent from security analysts and automated detection tools. A common method involves using the 'Set-Alias' or 'New-Alias' cmdlets to assign arbitrary names to built-in PowerShell commands. By mapping malicious or common system functions to non-standard names, attackers can render script analysis significantly more difficult, as traditional static analysis rules looking for specific cmdlet names will fail to identify the true command being executed. This technique is often seen in early-stage malware loaders and script-based droppers aiming to evade detection during the initial execution phase. Defenders should prioritize visibility into script block content to monitor for these redirection patterns.

Attack Chain

  1. Attacker develops a malicious PowerShell script intended for target execution.
  2. Attacker uses 'Set-Alias' or 'New-Alias' to create aliases for sensitive cmdlets like 'Invoke-Expression' or 'DownloadString'.
  3. The obfuscated script is delivered to the target environment via email attachments or document macros.
  4. The malicious script block is executed by the target user or a compromised process.
  5. PowerShell Script Block Logging (Event ID 4104) captures the execution of the alias definitions.
  6. The script continues execution using the redefined aliases to perform system discovery or C2 communication.
  7. The final objective, such as credential theft or lateral movement, is achieved while maintaining script stealth.

Impact

The use of alias-based obfuscation increases the risk of successful execution of malicious PowerShell payloads, as it reduces the efficacy of basic signature-based detection. This stealth can lead to undetected command execution, persistence, and potential data exfiltration within an enterprise environment.

Recommendation

  • Enable PowerShell Script Block Logging (Event ID 4104) via Group Policy to capture the full content of executing scripts.
  • Deploy the provided Sigma rule to your SIEM to monitor for 'Set-Alias' and 'New-Alias' usage, and tune out known-legitimate CIM-related aliases.
  • Centralize and ingest PowerShell operational logs into a log management system for historical script analysis.

Threat Hunt

Search for high volumes of Set-Alias or New-Alias events in environment

T1059.001 low low confidence convert to detection

Data: Event ID 4104 logs

Detection coverage 1

Potential PowerShell Obfuscation Using Alias Cmdlets

low

Detects the use of Set-Alias or New-Alias cmdlets which can be used to obfuscate PowerShell script intent by masking command names.

sigma tactics: execution, stealth techniques: T1027, T1059.001 sources: ps_script, windows

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