Skip to content

Commit 060feb0

Browse files
authored
Updating Query Based on XS Data (#3876)
1 parent d080ba9 commit 060feb0

1 file changed

Lines changed: 32 additions & 19 deletions

File tree

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,50 @@
11
name: DNS Query Length With High Standard Deviation
22
id: 1a67f15a-f4ff-4170-84e9-08cf6f75d6f5
3-
version: 11
4-
date: '2025-05-02'
3+
version: 12
4+
date: '2026-01-22'
55
author: Bhavin Patel, Splunk
66
status: production
77
type: Anomaly
88
description: The following analytic identifies DNS queries with unusually large lengths
99
by computing the standard deviation of query lengths and filtering those exceeding
10-
twice the standard deviation. It leverages DNS query data from the Network_Resolution
10+
two times the standard deviation. It leverages DNS query data from the Network_Resolution
1111
data model, focusing on the length of the domain names being resolved. This activity
1212
is significant as unusually long DNS queries can indicate data exfiltration or command-and-control
1313
communication attempts. If confirmed malicious, this activity could allow attackers
1414
to stealthily transfer data or maintain persistent communication channels within
1515
the network.
1616
data_source:
1717
- Sysmon EventID 22
18-
search: '| tstats `security_content_summariesonly` count from datamodel=Network_Resolution
19-
where NOT DNS.record_type IN("Pointer","PTR") by DNS.answer DNS.answer_count DNS.query
20-
DNS.query_count DNS.reply_code_id DNS.src DNS.vendor_product host | `drop_dm_object_name("DNS")`
21-
| eval tlds=split(query,".") | eval tld=mvindex(tlds,-1) | eval tld_len=len(tld)
22-
| search tld_len<=24 | eval query_length = len(query) | table host query query_length
23-
record_type count | eventstats stdev(query_length) AS stdev avg(query_length) AS
24-
avg p50(query_length) AS p50 | where query_length>(avg+stdev*2) | eval z_score=(query_length-avg)/stdev
18+
search: '
19+
| tstats `security_content_summariesonly` count min(_time) as firstTime
20+
max(_time) as lastTime from datamodel=Network_Resolution
21+
where NOT DNS.record_type IN ("Pointer","PTR","SOA", "SRV") DNS.query != *. by DNS.answer DNS.answer_count DNS.query
22+
DNS.query_count DNS.reply_code_id DNS.src DNS.vendor_product DNS.dest DNS.record_type
23+
| `drop_dm_object_name("DNS")`
24+
| `security_content_ctime(firstTime)`
25+
| `security_content_ctime(lastTime)`
26+
| eval tlds=split(query,".")
27+
| eval tld=mvindex(tlds,-1)
28+
| eval tld_len=len(tld)
29+
| search tld_len<=20
30+
| eval query_length = len(query)
31+
| table firstTime lastTime src dest query query_length record_type count record_type
32+
| eventstats stdev(query_length) AS stdev avg(query_length) AS
33+
avg p50(query_length) AS p50
34+
| where query_length>(avg+stdev*2)
35+
| eval z_score=(query_length-avg)/stdev
36+
| stats count values(query) as query values(dest) as dest avg(query_length) as avg_query_length values(record_type) as record_type min(firstTime) as firstTime latest(lastTime) as lastTime by src
2537
| `dns_query_length_with_high_standard_deviation_filter`'
2638
how_to_implement: To successfully implement this search, you will need to ensure that
2739
DNS data is populating the Network_Resolution data model.
2840
known_false_positives: It's possible there can be long domain names that are legitimate.
2941
references: []
3042
drilldown_searches:
31-
- name: View the detection results for - "$host$"
32-
search: '%original_detection_search% | search host = "$host$"'
43+
- name: View the detection results for - "$src$"
44+
search: '%original_detection_search% | search src = "$src$"'
3345
earliest_offset: $info_min_time$
3446
latest_offset: $info_max_time$
35-
- name: View risk events for the last 7 days for - "$host$"
47+
- name: View risk events for the last 7 days for - "$src$"
3648
search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$host$")
3749
starthoursago=168 | stats count min(_time) as firstTime max(_time) as lastTime
3850
values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories)
@@ -42,13 +54,14 @@ drilldown_searches:
4254
earliest_offset: $info_min_time$
4355
latest_offset: $info_max_time$
4456
rba:
45-
message: A dns query $query$ with 2 time standard deviation of name len of the dns
46-
query in host $host$
57+
message: Potentially suspicious DNS query [$query$] with high standard deviation from src - [$src$]
4758
risk_objects:
48-
- field: host
59+
- field: src
4960
type: system
50-
score: 56
51-
threat_objects: []
61+
score: 30
62+
threat_objects:
63+
- field: query
64+
type: url
5265
tags:
5366
analytic_story:
5467
- Hidden Cobra Malware
@@ -65,6 +78,6 @@ tags:
6578
tests:
6679
- name: True Positive Test
6780
attack_data:
68-
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1048.003/long_dns_queries/windows-sysmon.log
81+
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1071.004/long_dns_query/dns-sysmon.log
6982
source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational
7083
sourcetype: XmlWinEventLog

0 commit comments

Comments
 (0)