Suspicious XOR-Encoded PowerShell Command Line (Windows Process Creation)

Flags PowerShell (powershell.exe/pwsh) process executions with command-line indicators consistent with XOR/obfuscated scripting.

FreeUnreviewedSigmamediumv1
title: Suspicious XOR-Encoded PowerShell Command Line (Windows Process Creation)
id: 8728284c-ec60-4063-8e4e-35e801123069
related:
  - id: 5b572dcf-254b-425c-a8c5-d9af6bea35a6
    type: obsolete
  - id: bb780e0c-16cf-4383-8383-1e5471db6cf9
    type: derived
status: test
description: This rule identifies Windows processes running PowerShell (powershell.exe or pwsh.exe) whose command line contains an XOR-related marker ('bxor') and additional script elements consistent with encoded/obfuscated command construction. Such obfuscation can help attackers evade simple string-based detections and hide malicious payload logic within the PowerShell command line. It relies on Windows process creation telemetry, including the executable path, original file name, and full command line.
references:
  - https://speakerdeck.com/heirhabarov/hunting-for-powershell-abuse?slide=65
  - https://redcanary.com/blog/yellow-cockatoo/
  - https://zero2auto.com/2020/05/19/netwalker-re/
  - https://mez0.cc/posts/cobaltstrike-powershell-exec/
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_powershell_xor_commandline.yml
author: Sami Ruohonen, Harish Segar, Tim Shelton, Teymur Kheirkhabarov, Vasiliy Burov, oscd.community, Nasreddine Bencherchali, Huntrule Team
date: 2018-09-05
modified: 2023-01-30
tags:
  - attack.execution
  - attack.stealth
  - attack.t1059.001
  - attack.t1140
  - attack.t1027
logsource:
  category: process_creation
  product: windows
detection:
  selection_img:
    - Image|endswith:
        - \powershell.exe
        - \pwsh.exe
    - OriginalFileName:
        - PowerShell.EXE
        - pwsh.dll
    - Description: Windows PowerShell
    - Product: PowerShell Core 6
  selection_cli_xor:
    CommandLine|contains: bxor
  selection_cli_other:
    CommandLine|contains:
      - ForEach
      - for(
      - "for "
      - "-join "
      - -join'
      - -join"
      - -join`
      - ::Join
      - "[char]"
  condition: all of selection_*
falsepositives:
  - Unknown
level: medium
license: DRL-1.1

What it detects

This rule identifies Windows processes running PowerShell (powershell.exe or pwsh.exe) whose command line contains an XOR-related marker ('bxor') and additional script elements consistent with encoded/obfuscated command construction. Such obfuscation can help attackers evade simple string-based detections and hide malicious payload logic within the PowerShell command line. It relies on Windows process creation telemetry, including the executable path, original file name, and full 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.