Detection: Windows Native Messaging Host Registered By User Writable Binary

Description

The following analytic detects a binary running from a user-writable or Windows directory (C:\Users, C:\ProgramData, C:\PerfLogs or C:\Windows) that creates or modifies a Chrome or Edge NativeMessagingHosts registry key. This activity is significant because registering a native messaging host manifest lets a malicious browser extension launch arbitrary local programs, which has been abused for command and control and persistence. If confirmed malicious, an attacker could execute code through the browser each time the extension connects, outside the usual extension sandbox.

 1`sysmon` EventCode=13
 2registry_path IN (
 3    "*\\Chrome\\NativeMessagingHosts\\*",
 4    "*\\Edge\\NativeMessagingHosts\\*"
 5)
 6process_path IN (
 7    "*:\\PerfLogs\\*",
 8    "*:\\ProgramData\\*",
 9    "*:\\Users\\*",
10    "*:\\Windows\\*"
11)
12NOT process_path IN (
13    "*:\\Windows\\Installer\\*",
14    "*:\\Windows\\System32\\msiexec.exe",
15    "*:\\Windows\\System32\\reg.exe",
16    "*:\\Windows\\SysWOW64\\msiexec.exe",
17    "*:\\Windows\\SysWOW64\\reg.exe"
18)
19NOT registry_path IN (
20    "*\\NativeMessagingHosts\\com.anthropic.claude_browser_extension\\*",
21    "*\\NativeMessagingHosts\\com.anthropic.claude_code_browser_extension\\*",
22    "*\\NativeMessagingHosts\\com.microsoft.onedrive.nucleus.auth.provider\\*",
23    "*\\NativeMessagingHosts\\com.soundresearch.contentclassifier\\*",
24    "*\\NativeMessagingHosts\\com.wps.anydocextension\\*",
25    "*\\NativeMessagingHosts\\com.wps.pdfextension\\*"
26)
27NOT user IN ("SYSTEM", "*\\SYSTEM")
28
29
30| regex process_path!="(?i)[\\\\/]+AppData[\\\\/]+Local[\\\\/]+(?:[^\\\\/]+[\\\\/]+){1,}[^\\\\/]+\\.\\w+$"
31
32
33| stats count min(_time) as firstTime
34              max(_time) as lastTime
35
36 by dest user process_guid process_id process_name process_path
37    registry_path registry_value_name registry_value_data
38    vendor_product
39
40
41| `security_content_ctime(firstTime)`
42
43| `security_content_ctime(lastTime)`
44
45| `windows_native_messaging_host_registered_by_user_writable_binary_filter`

Data Source

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

Macros Used

Name Value
sysmon (source=WinEventLog:Microsoft-Windows-Sysmon/Operational OR source=XmlWinEventLog:Microsoft-Windows-Sysmon/Operational)
windows_native_messaging_host_registered_by_user_writable_binary_filter search *
windows_native_messaging_host_registered_by_user_writable_binary_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
T1176.001 Browser Extensions Persistence
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 Finding (Notable) Yes
Rule Title %name%
Rule Description %description%
Notable Event Fields user, dest
Creates Intermediate Finding (Risk Event) No
TTP detections generate a Finding (Notable) and may generate Intermediate Findings (Risk Events) for associated entities.

Implementation

This search requires Sysmon logs with a Sysmon configuration that includes EventID 13 (Registry value set) for the Chrome and Edge NativeMessagingHosts keys. If you are using Sysmon, you must have at least version 2.0 of the official Sysmon TA. This search uses an input macro named sysmon. We strongly recommend that you specify your environment-specific configurations (index, source, sourcetype, etc.) for Windows Sysmon logs. Replace the macro definition with configurations for your Splunk environment. The search also uses a post-filter macro designed to filter out known false positives. Update the exclusion lists with native messaging hosts that are legitimately registered in your environment.

Known False Positives

Software that registers a native messaging host from the user profile, ProgramData or a Windows subfolder (for example password managers, document tools and collaboration clients) may be returned. Validate the host and add its registry key name or process path to the exclusion list.

Associated Analytic Story

Finding

Title Entity Field Entity Type Risk Score
The process [$process_name$] on endpoint [$dest$] registered the native messaging host [$registry_path$] pointing to [$registry_value_data$]. dest system 50

Threat Objects

Field Type
registry_value_data file_path
registry_path registry_path
process_path file_path

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