Detection: Windows Suspicious C2 Named Pipe

Description

The following analytic detects the creation or connection to known suspicious C2 named pipes. It leverages Sysmon EventCodes 17 and 18 to identify known default pipe names used by C2 tools. If confirmed malicious, this could allow an attacker to abuse these to potentially gain persistence, command and control, or further system compromise.

 1`sysmon`
 2(EventCode=17 OR EventCode=18)
 3NOT process_path IN (
 4  "*:\\Program Files \(x86\)\\Adobe*",
 5  "*:\\Program Files \(x86\)\\Google*",
 6  "*:\\Program Files \(x86\)\\Microsoft*",
 7  "*:\\Program Files\\Adobe*",
 8  "*:\\Program Files\\Google*",
 9  "*:\\Program Files\\Microsoft*",
10  "*:\\Windows\\system32\\SearchIndexer.exe",
11  "*:\\Windows\\System32\\svchost.exe",
12  "*:\\Windows\\SystemApps\\Microsoft*",
13  "*\\Amazon\\SSM\\Instance*",
14  "*\\AppData\\Local\\Google*",
15  "*\\AppData\\Local\\Kingsoft\\*",
16  "*\\AppData\\Local\\Microsoft*",
17  "System"
18)
19
20
21| stats  min(_time) as firstTime max(_time) as lastTime
22count by dest dvc process_exec process_guid process_id process_path signature signature_id 
23vendor_product pipe_name user_id Image process_name
24
25
26| lookup suspicious_c2_named_pipes suspicious_pipe_name AS pipe_name OUTPUT tool, description
27
28| where isnotnull(tool)
29
30| `security_content_ctime(firstTime)`
31
32| `security_content_ctime(lastTime)`
33
34| `windows_suspicious_c2_named_pipe_filter`

Data Source

Name Platform Sourcetype Source
Sysmon EventID 17 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational'
Sysmon EventID 18 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational'

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
windows_suspicious_c2_named_pipe_filter search *
windows_suspicious_c2_named_pipe_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1559 Inter-Process Communication Execution
T1021.002 SMB/Windows Admin Shares Lateral Movement
T1055 Process Injection Defense Evasion
Exploitation
Installation
DE.CM
CIS 10

Default Configuration

This detection is configured by default in Splunk Enterprise Security to run with the following settings:

Setting Value
Disabled true
Cron Schedule 0 * * * *
Earliest Time -70m@m
Latest Time -10m@m
Schedule Window auto
Creates Notable Yes
Rule Title %name%
Rule Description %description%
Notable Event Fields user, dest
Creates Risk Event True
This configuration file applies to all detections of type TTP. These detections will use Risk Based Alerting and generate Notable Events.

Implementation

To successfully implement this search, you need to be ingesting logs with the process name and pipename from your endpoints. If you are using Sysmon, you must have at least version 6.0.4 of the Sysmon TA.

Known False Positives

False positives should be rare, investigate matches and apply additional filters as needed.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message:

An instance of $process_name$ located in $process_path$ was identified on endpoint $dest$ accessing known suspicious C2 named pipe $pipe_name$.

Risk Object Risk Object Type Risk Score Threat Objects
dest system 72 process_name

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Passing N/A N/A N/A
Unit Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational XmlWinEventLog
Integration ✅ Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational XmlWinEventLog

Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI. Alternatively you can replay a dataset into a Splunk Attack Range


Source: GitHub | Version: 1