Event ID 22: DNS Query
Sysmon Event 22 captures DNS queries made by processes, recording the queried domain name, query result, and the process responsible. This event is essential for detecting command-and-control communications, DNS tunneling, phishing domain contacts, and malicious domain generation algorithms used by malware.
- Channel
- Microsoft-Windows-Sysmon/Operational
- Logged by default
- No
- Written on
- Any host
- Volume
- Very high
- Provider
- Microsoft-Windows-Sysmon
- Needs a SACL
- No
To have this event
- Sysmon installed, with a configuration that includes this event type.
Key fields
Exact XML field names, as they appear in <Data Name="…"> and in SIEM field extractions.
| Field | What it tells you |
|---|---|
| UtcTime | UTC timestamp of DNS query |
| ProcessGuid | Process GUID making the query |
| ProcessId | Process ID |
| Image | Process executable path |
| QueryName | DNS hostname being queried |
| QueryStatus | DNS query result status code |
| QueryResults | Resolved IP address(es) |
Analyst notes
- 01Crucial Fields: QueryName, QueryStatus, QueryResults, Image.
- 02Look for queries to known malicious/suspicious domains (Threat Intel, DGAs).
- 03Identify high frequency of NXDOMAIN (QueryStatus=0x9003) responses, potentially indicating DGA activity.
- 04Monitor for DNS tunneling patterns (unusual subdomains, large query sizes - though size isn't logged by default).
- 05Filter known good/internal domains in Sysmon config.
In an investigation
Sysmon Event 22 provides visibility into DNS queries performed by processes on the system, capturing the domain name being resolved, the query results, and critically, which process initiated the query. This process-level attribution for DNS queries is not available in standard Windows DNS client logs, making Event 22 uniquely valuable for threat detection. Attackers use DNS for command-and-control communications because DNS traffic is often allowed through firewalls with minimal inspection, making it an attractive channel for malicious communications. Event 22 enables detection of malware beaconing to C2 infrastructure through domain queries, identification of DNS tunneling where data is exfiltrated through DNS requests, and discovery of domain generation algorithm (DGA) usage where malware queries randomly generated domains to find its control server. Security analysts can detect C2 domains by correlating DNS queries with threat intelligence feeds of known malicious domains, identify DGA activity through entropy analysis of queried domain names and observing high query volumes of non-existent domains (NXDOMAIN responses), and spot DNS tunneling through queries to domains with unusual characteristics like very long subdomains or high query frequency to a single domain. The process information reveals which application is performing DNS queries, enabling detection of unusual patterns like Office applications or PDF readers querying domains, which often indicates exploitation or embedded malware. By combining Event 22 with network connection events (Event 3), analysts can trace the complete network activity lifecycle from initial DNS resolution through the subsequent TCP/UDP connections to resolved IP addresses, providing comprehensive visibility into network-based attacks.
What it can reveal
- DNS queries for known malicious domains indicate active command-and-control communications
- High entropy domain names with random characters suggest domain generation algorithms used by malware
- Document viewers or Office apps performing DNS queries indicate exploitation or malicious content
- Numerous NXDOMAIN responses from a single process reveal DGA-based malware searching for C2 servers
- DNS queries with unusually long subdomains or high frequency may indicate DNS tunneling for data exfiltration
How to detect with it
Integrate DNS query logs with threat intelligence feeds to automatically flag queries to known malicious domains, C2 infrastructure, and phishing sites. Implement entropy scoring on queried domain names to identify DGA activity characterized by random-looking domain strings. Monitor for processes that don't normally perform DNS queries suddenly resolving domains, especially document viewers and media players. Track the volume of DNS queries per process and alert on unusual spikes or high-frequency query patterns. Alert on queries returning NXDOMAIN responses at high rates, which indicates DGA malware cycling through generated domains. Correlate Event 22 with process creation (Event 1) and network connections (Event 3) to build complete attack timelines from initial execution through DNS resolution to network communication. Maintain allowlists of legitimate high-volume DNS query sources like browsers and cloud sync clients to reduce false positives. Detailed threat intelligence integration guides and sample SIEM queries will be provided in upcoming documentation releases.
Attack patterns
- Qakbot malware generates distinctive DNS query patterns in Event 22 with algorithm-generated domains for C2 resilience
- APT1 campaigns used custom DNS tunneling protocols visible in Event 22 with characteristic long subdomain queries for data exfiltration
- Emotet infrastructure queries visible in Event 22 show patterns of accessing compromised WordPress sites for command-and-control
Compared withEvent 22 shows DNS queries, while Event 3 shows the resulting network connections. Together they provide complete network communication visibility from domain resolution through connection establishment.
Pull this event
Retrieval queries for a live host, a collected .evtx file and common SIEMs. Filter further on the key fields above.
Get-WinEvent -LogName 'Microsoft-Windows-Sysmon/Operational' -FilterXPath "*[System[(EventID=22)]]" -MaxEvents 50 |
Select-Object TimeCreated, Id, MachineName, Message-FilterXPath supports exact matches only. For substring matching, filter in Where-Object.
ATT&CK mapping
Techniques this event can help detect. Most of these depend on specific field values; the event alone does not mean the technique happened.
Also relevant, depending on field values
Related events
Common questions
- What does Windows event ID 22 mean?
- Sysmon Event 22 captures DNS queries made by processes, recording the queried domain name, query result, and the process responsible. This event is essential for detecting command-and-control communications, DNS tunneling, phishing domain contacts, and malicious domain generation algorithms used by malware.
- Is event 22 logged by default?
- No. It must be enabled before it is recorded.
- Where is event 22 recorded?
- In the Microsoft-Windows-Sysmon/Operational channel on the any host.
Decode a real event
Paste the XML and every value gets explained. Nothing leaves your browser.
Open decoderSysmon Event 22 captures DNS queries made by processes, recording the queried domain name, query result, and the process responsible.