Exfiltration (TA0010)(external, opens in a new tab or window)
Command and Control (TA0011)(external, opens in a new tab or window)
endpoint(external, opens in a new tab or window)
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).