Skip to content

Add hunting query: Potential Rootkit Network Activity via Firewall/EDR telemetry delta#14337

Open
YounesA343 wants to merge 4 commits into
Azure:masterfrom
YounesA343:hunting-query-PotentialRootkitTrafficMissingFromMDE
Open

Add hunting query: Potential Rootkit Network Activity via Firewall/EDR telemetry delta#14337
YounesA343 wants to merge 4 commits into
Azure:masterfrom
YounesA343:hunting-query-PotentialRootkitTrafficMissingFromMDE

Conversation

@YounesA343
Copy link
Copy Markdown
Contributor

Summary
This PR adds a highly resilient, compute-optimized analytic rule targeting advanced adversaries operating in Ring-0 (kernel space) that blind endpoint telemetry to exfiltrate data or communicate with C2 infrastructure.

Adversaries increasingly rely on Bring Your Own Vulnerable Driver (BYOVD) techniques to achieve kernel-level execution. A primary objective of this access is to unlink Windows Filtering Platform (WFP) callouts or inject raw frames directly into NDIS. This effectively blinds EDR sensors (like Microsoft Defender for Endpoint) to outbound network telemetry, allowing malware to beacon while the host otherwise appears completely healthy.

This query relies on the paradox created by this evasion: it compares "Network Truth" (out-of-band physical/virtual firewall appliance logs via ASimNetworkSessionLogs) against "Host Truth" (EDR telemetry via DeviceNetworkEvents). By shifting the detection to the network boundary, the endpoint-level ETW/WFP patch is rendered irrelevant.

Compute Optimizations Included:

  • Pre-filtering (activeMdeNodes): Before executing the expensive anti-join, the query identifies IPs actively reporting to MDE. This filters out IoT, BYOD, and unmanaged devices from the massive Firewall dataset, preventing O(N*M) compute explosions and false positives.
  • Data Stratification: Instead of using the massive DeviceNetworkEvents table to resolve Hostnames and Domains, the query leverages the lightweight DeviceNetworkInfo state table. It unpacks the JSON array to grab the exact DHCP/Hostname mapping with arg_max, saving massive cluster compute.
  • Left-Side Join Rule Compliance: The firewall dataset is heavily aggregated via summarize and explicitly time-bounded before acting as the left table in the leftanti join against the distinct MDE connection pairs.

Triage Readiness:
The query output is highly engineered for Tier 1 SOC analysts. It utilizes alertDetailsOverride to inject the compromised host and destination IP directly into the incident title, uses customDetails to pin exfiltrated byte counts to the overview blade, and strictly casts schema types to ensure entityMappings trigger the Sentinel Investigation Graph without errors.

Change(s):

  • Added PotentialRootkitTrafficMissingFromMDE.yaml to the Hunting Queries/Microsoft 365 Defender/ Defense Evasion directory.
  • Includes Entity Mappings for Host (HostName, DnsDomain) and IP (InternalIP, DestinationIP).
  • Includes Custom Details and Alert Details Override for dynamic incident generation.

Reason for Change(s):

  • Advanced malware and rootkits (e.g., using BYOVD) can successfully blind user-mode and kernel-mode EDR network sensors, creating a blind spot for exfiltration.
  • This query establishes a highly resilient detection mechanic by analyzing the delta between perimeter appliances and endpoint sensors.
  • It provides SOCs with a template that is safely optimized for high-volume enterprise environments without timing out the Kusto engine.

Version Updated:

  • N/A (This is a new hunting query template, version set to 1.0.0).

Testing Completed:

  • Yes. Queries were authored against the ASimNetworkSessionLogs, DeviceNetworkEvents, and DeviceNetworkInfo schemas.
  • Ensure the use of explicit string casting (tostring()) for entityMappings strictly follows the V3 entity guidelines.

Checked that the validations are passing and have addressed any issues that are present:

  • Yes. Ran the .script/tests/DetectionTemplateSchemaValidation/dotnet test local validation to ensure YAML structure, metadata (Tactics/Techniques), and KQL syntax are perfectly compliant with the repo's guidelines. Validated for non-ASCII characters.

@YounesA343 YounesA343 requested review from a team as code owners May 23, 2026 18:23
@v-maheshbh v-maheshbh self-assigned this May 25, 2026
@v-maheshbh v-maheshbh added the Hunting Hunting specialty review needed label May 25, 2026
@v-maheshbh v-maheshbh requested a review from Copilot May 26, 2026 05:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new Microsoft Sentinel hunting query template intended to detect potential kernel-level EDR network telemetry bypass by comparing perimeter “network truth” (ASimNetworkSessionLogs) vs MDE “host truth” (DeviceNetworkEvents/DeviceNetworkInfo).

Changes:

  • Introduces a new hunting query YAML with MITRE mappings, data connectors, query logic, and entity mappings.
  • Implements a left-anti join delta approach (firewall sessions present, MDE sessions absent) with pre-filtering to reduce compute.
  • Adds alert customization fields (custom details / title+description override) alongside the hunting query.

@@ -0,0 +1,203 @@
id: 564bf64a-bada-4c6b-8821-53138d660f78
name: Potential Rootkit Network Activity Missing from MDE

// Tier 1: Firewall Perimeter Identification
// ADAPTATION: Analysts MUST adjust these arrays to match their specific perimeter security stack.
let firewallVendors = dynamic(["Palo Alto Networks", "Fortinet", "Check Point", "Cisco", "Zscaler"]);
Identifies outbound network connections logged by perimeter firewalls that are entirely missing from Microsoft Defender for Endpoint (MDE) telemetry. This discrepancy strongly indicates a threat actor operating in kernel space, to hide C2 traffic.
description-detailed: |
Advanced adversaries operating in Ring-0 via BYOVD can unlink WFP (Windows Filtering Platform) callouts or inject raw frames into NDIS. This completely blinds EDR sensors like MDE to outbound network telemetry, while the host otherwise appears healthy. By comparing "Network Truth" (out-of-band firewall appliance logs) against "Host Truth" (EDR telemetry), we trap the adversary in a paradox. Kernel-level tampering on the endpoint cannot hide the physical packet leaving the network boundary.
severity: High
Comment on lines +183 to +185
alertDetailsOverride:
alertDisplayNameFormat: "Potential Rootkit Network Activity from {{HostName}} to {{DestinationIP}}"
alertDescriptionFormat: "Firewall logs indicate {{HostName}} ({{InternalIP}}) transmitted {{TotalBytesSent}} bytes to {{DestinationIP}}, but Microsoft Defender is completely blind to this traffic, indicating likely kernel-level EDR tampering."
| where Timestamp between (starttime .. endtime)
| where isnotempty(IPAddresses) and isnotempty(DeviceName)
// Expand the JSON array of IP addresses so each IP gets its own row
| mv-expand todynamic(IPAddresses)
@v-maheshbh
Copy link
Copy Markdown
Contributor

Hi @YounesA343
Kindly review the above comments and address them as needed.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Hunting Hunting specialty review needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants