Detection: Windows PUA Named Pipe

Description

The following analytic detects the creation or connection to named pipes used by potentially unwanted applications (PUAs) like VPNs or utilities like PsExec. It leverages Sysmon EventCodes 17 and 18. 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\\dotnet\\dotnet.exe",
 9  "*:\\Program Files\\Google*",
10  "*:\\Program Files\\Microsoft*",
11  "*:\\Windows\\system32\\SearchIndexer.exe",
12  "*:\\Windows\\System32\\svchost.exe",
13  "*:\\Windows\\SystemApps\\Microsoft*",
14  "*\\Amazon\\SSM\\Instance*",
15  "*\\AppData\\Local\\Google*",
16  "*\\AppData\\Local\\Kingsoft\\*",
17  "*\\AppData\\Local\\Microsoft*",
18  "System"
19)
20
21
22| stats  min(_time) as firstTime max(_time) as lastTime
23count by dest dvc process_exec process_guid process_id process_path signature signature_id 
24vendor_product pipe_name user_id Image process_name
25
26
27| lookup pua_named_pipes pua_pipe_name AS pipe_name OUTPUT tool, description
28
29| where isnotnull(tool)
30
31| `security_content_ctime(firstTime)`
32
33| `security_content_ctime(lastTime)`
34
35| `windows_pua_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_pua_named_pipe_filter search *
windows_pua_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.AE
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 Risk Event True
This configuration file applies to all detections of type anomaly. These detections will use Risk Based Alerting.

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

PUAs can be used in a legitimate manner. Therefore, some of the named pipes identified and added may cause false positives. Filter by process name or pipe name to reduce false positives.

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 named pipe $pipe_name$ from a potentially unwanted application in your environment.

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