Detection rules › Sigma

CobaltStrike Named Pipe

Status
test
Severity
critical
Log source
product windows, category pipe_created
Author
Florian Roth (Nextron Systems), Wojciech Lesicki
Source
github.com/SigmaHQ/sigma

Detects the creation of a named pipe as used by CobaltStrike

MITRE ATT&CK coverage

TacticTechniques
Privilege EscalationT1055 Process Injection
StealthT1055 Process Injection

Event coverage

Rule body yaml

title: CobaltStrike Named Pipe
id: d5601f8c-b26f-4ab0-9035-69e11a8d4ad2
related:
    - id: 85adeb13-4fc9-4e68-8a4a-c7cb2c336eb7 # Patterns
      type: similar
    - id: 0e7163d4-9e19-4fa7-9be6-000c61aad77a # Regex
      type: similar
status: test
description: Detects the creation of a named pipe as used by CobaltStrike
references:
    - https://twitter.com/d4rksystem/status/1357010969264873472
    - https://labs.f-secure.com/blog/detecting-cobalt-strike-default-modules-via-named-pipe-analysis/
    - https://github.com/SigmaHQ/sigma/issues/253
    - https://blog.cobaltstrike.com/2021/02/09/learn-pipe-fitting-for-all-of-your-offense-projects/
    - https://redcanary.com/threat-detection-report/threats/cobalt-strike/
author: Florian Roth (Nextron Systems), Wojciech Lesicki
date: 2021-05-25
modified: 2022-10-31
tags:
    - attack.privilege-escalation
    - attack.stealth
    - attack.t1055
logsource:
    product: windows
    category: pipe_created
    definition: 'Note that you have to configure logging for Named Pipe Events in Sysmon config (Event ID 17 and Event ID 18). The basic configuration is in popular sysmon configuration (https://github.com/SwiftOnSecurity/sysmon-config), but it is worth verifying. You can also use other repo, e.g. https://github.com/Neo23x0/sysmon-config, https://github.com/olafhartong/sysmon-modular. How to test detection? You can always use Cobalt Strike, but also you can check powershell script from this site https://svch0st.medium.com/guide-to-named-pipes-and-hunting-for-cobalt-strike-pipes-dc46b2c5f575'
detection:
    selection_MSSE:
        PipeName|contains|all:
            - '\MSSE-'
            - '-server'
    selection_postex:
        PipeName|startswith: '\postex_' # Also include the pipe "\postex_ssh_"
    selection_status:
        PipeName|startswith: '\status_'
    selection_msagent:
        PipeName|startswith: '\msagent_'
    selection_mojo:
        PipeName|startswith: '\mojo_'
    selection_interprocess:
        PipeName|startswith: '\interprocess_'
    selection_samr:
        PipeName|startswith: '\samr_'
    selection_netlogon:
        PipeName|startswith: '\netlogon_'
    selection_srvsvc:
        PipeName|startswith: '\srvsvc_'
    selection_lsarpc:
        PipeName|startswith: '\lsarpc_'
    selection_wkssvc:
        PipeName|startswith: '\wkssvc_'
    condition: 1 of selection*
falsepositives:
    - Unknown
level: critical

Stages and Predicates

Stage 0: condition

1 of selection*

Stage 1: selection_MSSE

selection_MSSE:
    PipeName|contains|all:
        - '\MSSE-'
        - '-server'

Stage 2: selection_postex

selection_postex:
    PipeName|startswith: '\postex_'

Stage 3: selection_status

selection_status:
    PipeName|startswith: '\status_'

Stage 4: selection_msagent

selection_msagent:
    PipeName|startswith: '\msagent_'

Stage 5: selection_mojo

selection_mojo:
    PipeName|startswith: '\mojo_'

Stage 6: selection_interprocess

selection_interprocess:
    PipeName|startswith: '\interprocess_'

Stage 7: selection_samr

selection_samr:
    PipeName|startswith: '\samr_'

Stage 8: selection_netlogon

selection_netlogon:
    PipeName|startswith: '\netlogon_'

Stage 9: selection_srvsvc

selection_srvsvc:
    PipeName|startswith: '\srvsvc_'

Stage 10: selection_lsarpc

selection_lsarpc:
    PipeName|startswith: '\lsarpc_'

Stage 11: selection_wkssvc

selection_wkssvc:
    PipeName|startswith: '\wkssvc_'

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
PipeNamematch
  • -server
  • \MSSE-
PipeNamestarts_with
  • \interprocess_
  • \lsarpc_
  • \mojo_
  • \msagent_
  • \netlogon_
  • \postex_
  • \samr_
  • \srvsvc_
  • \status_
  • \wkssvc_