Detection rules › Sigma

Potential Meterpreter/CobaltStrike Activity

Status
test
Severity
high
Log source
product windows, category process_creation
Author
Teymur Kheirkhabarov, Ecco, Florian Roth
Source
github.com/SigmaHQ/sigma

Detects the use of getsystem Meterpreter/Cobalt Strike command by detecting a specific service starting

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Potential Meterpreter/CobaltStrike Activity
id: 15619216-e993-4721-b590-4c520615a67d
status: test
description: Detects the use of getsystem Meterpreter/Cobalt Strike command by detecting a specific service starting
references:
    - https://speakerdeck.com/heirhabarov/hunting-for-privilege-escalation-in-windows-environment
    - https://blog.cobaltstrike.com/2014/04/02/what-happens-when-i-type-getsystem/
author: Teymur Kheirkhabarov, Ecco, Florian Roth
date: 2019-10-26
modified: 2023-02-05
tags:
    - attack.privilege-escalation
    - attack.stealth
    - attack.t1134.001
    - attack.t1134.002
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        ParentImage|endswith: '\services.exe'
    selection_technique_1:
        # Examples:
        #   Meterpreter  getsystem technique 1: cmd.exe /c echo 559891bb017 > \\.\pipe\5e120a
        #   CobaltStrike getsystem technique 1b (expanded env var): %COMSPEC% /c echo 559891bb017 > \\.\pipe\5e120a
        #   CobaltStrike getsystem technique 1: %COMSPEC% /c echo 559891bb017 > \\.\pipe\5e120a
        CommandLine|contains|all:
            - '/c'
            - 'echo'
            - '\pipe\'
        CommandLine|contains:
            - 'cmd'
            - '%COMSPEC%'
    selection_technique_2:
        # meterpreter getsystem technique 2: rundll32.exe C:\Users\test\AppData\Local\Temp\tmexsn.dll,a /p:tmexsn
        CommandLine|contains|all:
            - 'rundll32'
            - '.dll,a'
            - '/p:'
    filter_defender:
        CommandLine|contains: 'MpCmdRun'
    condition: selection_img and 1 of selection_technique_* and not 1 of filter_*
falsepositives:
    - Commandlines containing components like cmd accidentally
    - Jobs and services started with cmd
level: high

Stages and Predicates

Stage 0: condition

selection_img and 1 of selection_technique_* and not 1 of filter_*

Stage 1: selection_img

selection_img:
    ParentImage|endswith: '\services.exe'

Stage 2: selection_technique_1

selection_technique_1:
    CommandLine|contains|all:
        - '/c'
        - 'echo'
        - '\pipe\'
    CommandLine|contains:
        - 'cmd'
        - '%COMSPEC%'

Stage 3: selection_technique_2

selection_technique_2:
    CommandLine|contains|all:
        - 'rundll32'
        - '.dll,a'
        - '/p:'

Stage 4: not filter_defender

filter_defender:
    CommandLine|contains: 'MpCmdRun'

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
CommandLinematchMpCmdRun

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
  • %COMSPEC% corpus 6 (sigma 5, splunk 1)
  • .dll,a
  • /c corpus 15 (sigma 13, splunk 2)
  • /p:
  • \pipe\
  • cmd corpus 8 (sigma 8)
  • echo corpus 8 (sigma 4, splunk 4)
  • rundll32 corpus 26 (sigma 23, chronicle 2, kusto 1)
ParentImageends_with
  • \services.exe corpus 8 (sigma 8)