Detection rules › Sigma

PowerShell Base64 Encoded Invoke Keyword

Status
test
Severity
high
Log source
product windows, category process_creation
Author
pH-T (Nextron Systems), Harjot Singh, @cyb3rjy0t
Source
github.com/SigmaHQ/sigma

Detects UTF-8 and UTF-16 Base64 encoded powershell 'Invoke-' calls

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: PowerShell Base64 Encoded Invoke Keyword
id: 6385697e-9f1b-40bd-8817-f4a91f40508e
related:
    - id: fd6e2919-3936-40c9-99db-0aa922c356f7
      type: obsolete
status: test
description: Detects UTF-8 and UTF-16 Base64 encoded powershell 'Invoke-' calls
references:
    - https://thedfirreport.com/2022/05/09/seo-poisoning-a-gootloader-story/
author: pH-T (Nextron Systems), Harjot Singh, @cyb3rjy0t
date: 2022-05-20
modified: 2023-04-06
tags:
    - attack.execution
    - attack.stealth
    - attack.t1059.001
    - attack.t1027
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        - Image|endswith:
              - '\powershell.exe'
              - '\pwsh.exe'
        - OriginalFileName:
              - 'PowerShell.EXE'
              - 'pwsh.dll'
    selection_cli_enc:
        CommandLine|contains: ' -e'
    selection_cli_invoke:
        CommandLine|contains:
            # Invoke-
            # UTF-16LE
            - 'SQBuAHYAbwBrAGUALQ'
            - 'kAbgB2AG8AawBlAC0A'
            - 'JAG4AdgBvAGsAZQAtA'
            # UTF-8
            - 'SW52b2tlL'
            - 'ludm9rZS'
            - 'JbnZva2Ut'
    condition: all of selection_*
falsepositives:
    - Unknown
level: high

Stages and Predicates

Stage 0: condition

all of selection_*

Stage 1: selection_img

selection_img:
    - Image|endswith:
          - '\powershell.exe'
          - '\pwsh.exe'
    - OriginalFileName:
          - 'PowerShell.EXE'
          - 'pwsh.dll'

Stage 2: selection_cli_enc

selection_cli_enc:
    CommandLine|contains: ' -e'

Stage 3: selection_cli_invoke

selection_cli_invoke:
    CommandLine|contains:
        - 'SQBuAHYAbwBrAGUALQ'
        - 'kAbgB2AG8AawBlAC0A'
        - 'JAG4AdgBvAGsAZQAtA'
        - 'SW52b2tlL'
        - 'ludm9rZS'
        - 'JbnZva2Ut'

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
CommandLinematch
  • -e corpus 6 (sigma 5, splunk 1)
  • JAG4AdgBvAGsAZQAtA
  • JbnZva2Ut
  • SQBuAHYAbwBrAGUALQ
  • SW52b2tlL
  • kAbgB2AG8AawBlAC0A
  • ludm9rZS
Imageends_with
  • \powershell.exe corpus 182 (sigma 182)
  • \pwsh.exe corpus 168 (sigma 168)
OriginalFileNameeq
  • PowerShell.EXE corpus 120 (sigma 84, splunk 30, elastic 6)
  • pwsh.dll corpus 112 (sigma 79, splunk 30, elastic 3)