Skip to content
SOC Analyst Role
  • Loading index…

↑↓ navigate · ↵ open · Esc close

en

Sysmon · Network

Sysmon 22 · DNSEvent (DNS query)

Sysmon Event ID 22 records DNS queries made through the Windows DNS client along with the process that made them and the results. It links a domain lookup to a specific executable, which DNS server logs cannot do, making it valuable for C2 discovery, DNS tunnelling and phishing payload tracking.

low prioritySysmon logNetworkMITRE T1071.004

Where it is logged

Microsoft-Windows-Sysmon/Operational on endpoints and servers. Requires Sysmon 10 or later on Windows 8.1 / Server 2012 R2 or later (it relies on the DNS client ETW provider) and a config that includes DnsQuery, usually with exclusions for common domains. Lookups that bypass the Windows DNS client (e.g. tools using their own resolver or DNS over HTTPS) are not captured.

Key fields to read

FieldWhat it tells you
QueryNameDomain name queried.
QueryStatusResult code; 0 success, 9003 name does not exist (NXDOMAIN).
QueryResultsReturned records, e.g. ::ffff:203.0.113.45; or type: 5 alias.example; for CNAMEs.
ImageProcess that performed the lookup.
UserAccount context of the process (newer Sysmon versions).
ProcessGuidPivot to Sysmon 1 and Sysmon 3 for the same process.

Sample event

Sysmon 22 — synthetic example
Log Name: Microsoft-Windows-Sysmon/Operational
EventID: 22
UtcTime: 2026-11-19 10:41:17.884
Computer: NW-FIN-WS07.northwind.local
ProcessGuid: {4f1c2b7e-a3f1-6740-6c05-000000002200}
ProcessId: 9012
QueryName: q7f3k9x2mzl0v8b4n1c6d5a2h7j0p3r9.t.cdn-update-check.example
QueryStatus: 0
QueryResults: ::ffff:198.51.100.23;
Image: C:\ProgramData\Intel\svch.exe
User: NORTHWIND\l.brandt

How to triage it

  1. 1Check Image: browsers and system services resolving many domains is normal; scripting engines, Office or binaries in ProgramData/Temp resolving external domains are not.
  2. 2Assess QueryName: domain age and reputation, look-alike spelling, and whether it is new to the environment.
  3. 3Look for tunnelling patterns: long, high-entropy subdomain labels, many unique subdomains under one parent domain, or TXT-heavy traffic.
  4. 4Check QueryStatus volume: many 9003 NXDOMAIN results from one process can indicate a DGA.
  5. 5Pivot on ProcessGuid and QueryResults IPs to Sysmon 3 connections and to proxy/firewall logs to confirm communication.

Benign vs suspicious

Usually benign

  • Browsers, Teams and Microsoft 365 resolving hundreds of CDN and telemetry domains.
  • Security agents and update services resolving cloud endpoints.
  • CDN or anti-spam services that legitimately use long hashed subdomains.

Red flags

  • High-entropy subdomains (30+ random characters) under the same parent domain repeated many times: DNS tunnelling or exfiltration.
  • Lookups of newly registered or look-alike domains by powershell.exe, mshta.exe, rundll32.exe or Office.
  • Bursts of NXDOMAIN (9003) results from one process (DGA behaviour).
  • Regular, periodic lookups of the same domain by a non-browser process (beaconing).

Hunt for it: Splunk & KQL

Splunk SPL
index=sysmon EventCode=22
| eval first_label=mvindex(split(QueryName, "."), 0)
| where len(first_label) > 30
| rex field=QueryName "(?<parent_domain>[^.]+\.[^.]+)$"
| stats count dc(QueryName) AS unique_queries values(Image) AS images BY host, parent_domain
| where unique_queries > 50
| sort - unique_queries
Sentinel KQL
// Defender for Endpoint DeviceEvents (ActionType DnsQueryResponse): long random subdomains per parent domain
DeviceEvents
| where Timestamp > ago(1d)
| where ActionType == "DnsQueryResponse"
| extend Query = tostring(parse_json(AdditionalFields).DnsQueryString)
| extend Labels = split(Query, ".")
| extend FirstLabel = tostring(Labels[0]), ParentDomain = strcat(tostring(Labels[-2]), ".", tostring(Labels[-1]))
| where strlen(FirstLabel) > 30
| summarize UniqueQueries = dcount(Query), Sample = make_set(Query, 5) by DeviceName, InitiatingProcessFileName, ParentDomain
| where UniqueQueries > 50

Field names depend on your add-on and table. More translations in the Splunk vs KQL cheat sheet.

Interview question

“How would you detect DNS tunnelling on endpoints?”

✓ Strong answer sketch

DNS tunnelling encodes data in subdomain labels, so I look for many unique, long, high-entropy subdomains under a single parent domain, often with unusual record types like TXT. Sysmon Event 22 helps because it attributes each QueryName to the Image that made it, so I can tell a browser hitting a CDN from an unknown binary in ProgramData generating thousands of random labels. I would aggregate by parent domain and process, measure label length or entropy, and compare against a baseline of known CDN patterns. Then I confirm with DNS server or firewall logs, block the domain, and investigate the process.

More SOC interview questions

Frequently asked questions

What are the requirements for Sysmon Event 22?

Sysmon 10 or later on Windows 8.1 / Server 2012 R2 or later, with DnsQuery enabled in the Sysmon config.

What does QueryStatus 9003 mean in Sysmon?

9003 is DNS_ERROR_RCODE_NAME_ERROR, i.e. the name does not exist (NXDOMAIN). Many of these from one process can indicate a domain generation algorithm.

Does Sysmon 22 see DNS over HTTPS?

Not when an application uses its own DoH resolver, because the lookup bypasses the Windows DNS client. Windows native DoH still goes through the DNS client and is generally captured.