Potential DNS Exfiltration via Excessive Chunked Queries

Last updated 2 months ago on 2026-07-03
Created 2 months ago on 2026-07-03

About

Identifies potential DNS exfiltration on Windows hosts by detecting a high volume of DNS queries whose subdomain labels follow a chunked encoding pattern (index-payload.base_domain). Attackers split stolen data across many DNS queries to evade volume-based detection; this rule aggregates queries per process, base domain, and five-minute window and flags sessions with many distinct chunk indices and sufficiently long encoded payloads.
Tags
Domain: EndpointOS: WindowsUse Case: Threat DetectionTactic: ExfiltrationData Source: Elastic DefendData Source: CrowdstrikeData Source: SysmonLanguage: esql
Severity
medium
Risk Score
47
MITRE ATT&CK™

Exfiltration (TA0010)(external, opens in a new tab or window)

Command and Control (TA0011)(external, opens in a new tab or window)

License
Elastic License v2(external, opens in a new tab or window)

Definition

Integration Pack
Prebuilt Security Detection Rules
Related Integrations

endpoint(external, opens in a new tab or window)

windows(external, opens in a new tab or window)

crowdstrike(external, opens in a new tab or window)

Query
text code block:
FROM logs-crowdstrike.fdr*, logs-endpoint.events.network-*, logs-windows.sysmon_operational-* | WHERE host.os.type == "windows" AND event.category == "network" AND event.action IN ("lookup_requested", "DNSEvent (DNS query)", "DnsRequest") AND process.name != "svchost.exe" AND dns.question.name RLIKE """[0-9]{1,5}-[A-Za-z0-9+/=]{15,63}\..+""" | GROK dns.question.name "%{INT:chunk_index}-%{DATA:chunk_payload}\\.%{GREEDYDATA:Esql.base_domain}" | WHERE chunk_index IS NOT NULL | EVAL payload_len = LENGTH(chunk_payload) | STATS Esql.occurrences = COUNT(*), Esql.unique_chunks = COUNT_DISTINCT(chunk_index), Esql.max_index = MAX(TO_INTEGER(chunk_index)), Esql.avg_payload_len = AVG(payload_len) BY process.name, Esql.base_domain, user.id, user.name, host.id, host.name, data_stream.namespace, DATE_TRUNC(5 minutes, @timestamp) | WHERE Esql.occurrences >= 30 AND Esql.unique_chunks >= 30 AND Esql.avg_payload_len >= 20 | SORT Esql.unique_chunks DESC | LIMIT 20 | KEEP host.id, host.name, process.name, user.id, user.name, data_stream.namespace, Esql.*

Install detection rules in Elastic Security

Detect Potential DNS Exfiltration via Excessive Chunked Queries in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).