Windows Process Creation: Detect Reversed PowerShell Command Tokens in CommandLine

Alerts on suspicious reversed token usage in PowerShell command lines on Windows, excluding -EncodedCommand / -enc.

FreeUnreviewedSigmahighv1
title: "Windows Process Creation: Detect Reversed PowerShell Command Tokens in CommandLine"
id: ecb0a7db-4265-4e57-bfe6-32574348d682
status: test
description: This rule flags Windows process creation events where PowerShell (powershell.exe or pwsh.exe) is launched with CommandLine content containing specific reversed-character tokens. Reversed strings are commonly used to obscure what the script is doing and may hinder straightforward command inspection. The detection relies on process creation telemetry and the Image and CommandLine fields, while excluding cases that include common encoded-command flags to reduce false positives.
references:
  - https://2019.offzone.moscow/ru/report/hunting-for-powershell-abuses/
  - https://speakerdeck.com/heirhabarov/hunting-for-powershell-abuse?slide=66
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_powershell_cmdline_reversed_strings.yml
author: Teymur Kheirkhabarov (idea), Vasiliy Burov (rule), oscd.community, Tim Shelton, Huntrule Team
date: 2020-10-11
modified: 2023-05-31
tags:
  - attack.stealth
  - attack.t1027
  - attack.execution
  - attack.t1059.001
logsource:
  category: process_creation
  product: windows
detection:
  selection_img:
    - Image|endswith:
        - \powershell.exe
        - \pwsh.exe
    - OriginalFileName:
        - PowerShell.EXE
        - pwsh.dll
  selection_cli:
    CommandLine|contains:
      - hctac
      - kaerb
      - dnammoc
      - ekovn
      - eliFd
      - rahc
      - etirw
      - golon
      - tninon
      - eddih
      - tpircS
      - ssecorp
      - llehsrewop
      - esnopser
      - daolnwod
      - tneilCbeW
      - tneilc
      - ptth
      - elifotevas
      - 46esab
      - htaPpmeTteG
      - tcejbO
      - maerts
      - hcaerof
      - retupmoc
  filter_main_encoded_keyword:
    CommandLine|contains:
      - " -EncodedCommand "
      - " -enc "
  condition: all of selection_* and not 1 of filter_main_*
falsepositives:
  - Unlikely
level: high
license: DRL-1.1
related:
  - id: b6b49cd1-34d6-4ead-b1bf-176e9edba9a4
    type: derived

What it detects

This rule flags Windows process creation events where PowerShell (powershell.exe or pwsh.exe) is launched with CommandLine content containing specific reversed-character tokens. Reversed strings are commonly used to obscure what the script is doing and may hinder straightforward command inspection. The detection relies on process creation telemetry and the Image and CommandLine fields, while excluding cases that include common encoded-command flags to reduce false positives.

Known false positives

  • Unlikely

Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.