# Hunt Suspicious Domains and Subdomains in Microsoft Defender XDR

Author: [Opeyemi Enitan](https://blog.threatintels.org/blog/about.html)

Canonical article: https://blog.threatintels.org/blog/defender-domain-hunting-process-attribution-2025.html

Historical project period: October 2025 (2025-10)

## Why this matters

When a malicious domain is reported by threat intelligence or a security investigation, blocking it is only part of the response. Analysts still need to determine whether endpoints attempted to reach it, which processes were involved and whether the connection was allowed or blocked.

This guide provides a Defender XDR hunting workflow for matching domains and their subdomains, identifying affected devices and attributing network activity to processes without treating a network match as proof of compromise.

PRACTICAL WALKTHROUGH

## What you'll accomplish

Identify indicator-matching network events, affected devices and the processes behind the activity.

### Before you begin

- Advanced Hunting access and onboarded Defender endpoints
- A verified indicator and a bounded investigation time window
- Access to DeviceNetworkEvents and DeviceProcessEvents

**Verify the result:** Confirm exact host and subdomain matching, identify the initiating process and distinguish allowed, blocked and attempted connections.

## What the hunt should establish

Use Microsoft Defender XDR Advanced Hunting to find endpoints that contacted an indicator domain or its subdomains, then attribute the connection to an initiating process. A DNS or network match is evidence to investigate, not proof of execution or compromise.

This walkthrough uses `suspicious.example.invalid`, not the incident's real indicator. The example is designed for **Microsoft Defender XDR Advanced Hunting**.

## Step 1 — Match the domain and its real subdomains

kusto

```
let indicator = "suspicious.example.invalid";
DeviceNetworkEvents
| where Timestamp > ago(14d)
| extend UrlRaw = tostring(RemoteUrl)
| extend Host = tolower(tostring(parse_url(
    iff(UrlRaw contains "://", UrlRaw, strcat("https://", UrlRaw))).Host))
| where Host == indicator or Host endswith strcat(".", indicator)
| project Timestamp, DeviceName, DeviceId, ActionType,
          RemoteIP, RemotePort, RemoteUrl,
          InitiatingProcessFileName, InitiatingProcessCommandLine,
          InitiatingProcessAccountName, InitiatingProcessSHA1
| order by Timestamp desc
```

An explicit host match is safer than `contains`: a lookalike such as `notsuspicious.example.invalid` must not match. If `RemoteUrl` is empty, inspect supported DNS/firewall data before mapping an IP to a historical domain. IP-to-host attribution can be unreliable on shared hosting and CDNs.

## Step 2 — Identify affected devices

kusto

```
let indicator = "suspicious.example.invalid";
DeviceNetworkEvents
| where Timestamp > ago(14d)
| where RemoteUrl has indicator
| summarize NetworkEvents=count(), FirstSeen=min(Timestamp),
            LastSeen=max(Timestamp),
            Processes=make_set(InitiatingProcessFileName, 20)
   by DeviceId, DeviceName, ActionType
| order by NetworkEvents desc
```

Use this as a *candidate summary*, not a final domain-matching detector: `has` is token-based and can behave differently around punctuation. Re-run the strict host-normalisation query before attributing any device. Assess the mix of allowed, denied and name-resolution events and compare the endpoint time with proxy telemetry.

## Step 3 — Investigate process and file activity

Pivot using the **DeviceId** and a narrow time window. Match on process creation time and other process identifiers where available, because process IDs can be reused.

kusto

```
let device = "example-device-id";
DeviceProcessEvents
| where Timestamp between (ago(2d) .. now())
| where DeviceId == device
| project Timestamp, DeviceName, AccountName, FileName,
          ProcessCommandLine, SHA1,
          InitiatingProcessFileName, InitiatingProcessCommandLine,
          ProcessId, ProcessCreationTime
| order by Timestamp asc
```

Review whether a browser, installer, script interpreter or unexpected process initiated the traffic. Add `DeviceFileEvents` for related file creation, checking `FileOriginUrl` when populated. Distinguish observed behavior from what the alert merely suggested.

## Step 4 — Validate the finding and choose a response

For a controlled lab exercise, use a test domain and known process, produce an allowed event and a blocked event, and compare their `ActionType` values. Verify DNS telemetry availability, timestamp consistency and whether the process metadata is complete.

If malicious execution or suspicious files are supported by evidence, follow approved response procedures. A domain hit by itself is not proof of data theft, malware execution or an account compromise.

## Further reading

- [DeviceNetworkEvents schema](https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-devicenetworkevents-table)
- [DeviceProcessEvents schema](https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-deviceprocessevents-table)
- [Advanced hunting query best practices](https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-best-practices)

[← Browse more field notes](https://blog.threatintels.org/blog/index.html)
