Detection rules › Sigma

Meterpreter or Cobalt Strike Getsystem Service Installation - System

Status
test
Severity
high
Log source
product windows, service system
Author
Teymur Kheirkhabarov, Ecco, Florian Roth (Nextron Systems)
Source
github.com/SigmaHQ/sigma

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

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Meterpreter or Cobalt Strike Getsystem Service Installation - System
id: 843544a7-56e0-4dcc-a44f-5cc266dd97d6
status: test
description: Detects the use of getsystem Meterpreter/Cobalt Strike command by detecting a specific service installation
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 (Nextron Systems)
date: 2019-10-26
modified: 2023-11-15
tags:
    - attack.privilege-escalation
    - attack.stealth
    - attack.t1134.001
    - attack.t1134.002
logsource:
    product: windows
    service: system
detection:
    selection_id:
        Provider_Name: 'Service Control Manager'
        EventID: 7045
    selection_cli_cmd:
        # meterpreter getsystem technique 1: cmd.exe /c echo 559891bb017 > \\.\pipe\5e120a
        # cobaltstrike getsystem technique 1: %COMSPEC% /c echo 559891bb017 > \\.\pipe\5e120a
        # cobaltstrike getsystem technique 1b (expanded %COMSPEC%): %COMSPEC% /c echo 559891bb017 > \\.\pipe\5e120a
        ImagePath|contains|all:
            - '/c'
            - 'echo'
            - '\pipe\'
        ImagePath|contains:
        - 'cmd'
        - '%COMSPEC%'
    selection_cli_rundll:
        # meterpreter getsystem technique 2: rundll32.exe C:\Users\test\AppData\Local\Temp\tmexsn.dll,a /p:tmexsn
        ImagePath|contains|all:
            - 'rundll32'
            - '.dll,a'
            - '/p:'
    selection_cli_share:
        ImagePath|startswith: '\\\\127.0.0.1\\ADMIN$\'  # https://twitter.com/svch0st/status/1413688851877416960?lang=en
    condition: selection_id and 1 of selection_cli_*
falsepositives:
    - Unlikely
level: high

Stages and Predicates

Stage 0: condition

selection_id and 1 of selection_cli_*

Stage 1: selection_id

selection_id:
    Provider_Name: 'Service Control Manager'
    EventID: 7045

Stage 2: selection_cli_cmd

selection_cli_cmd:
    ImagePath|contains|all:
        - '/c'
        - 'echo'
        - '\pipe\'
    ImagePath|contains:
    - 'cmd'
    - '%COMSPEC%'

Stage 3: selection_cli_rundll

selection_cli_rundll:
    ImagePath|contains|all:
        - 'rundll32'
        - '.dll,a'
        - '/p:'

Stage 4: selection_cli_share

selection_cli_share:
    ImagePath|startswith: '\\\\127.0.0.1\\ADMIN$\'

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
ImagePathmatch
  • %COMSPEC% corpus 2 (sigma 2)
  • .dll,a
  • /c corpus 4 (sigma 4)
  • /p:
  • \pipe\
  • cmd corpus 5 (sigma 5)
  • echo
  • rundll32 corpus 4 (sigma 4)
ImagePathstarts_with
  • \\\\127.0.0.1\\ADMIN$\
Provider_Nameeq
  • Service Control Manager corpus 50 (sigma 50)