Detection rules › Elastic
DNS Over HTTPS by an Unusual Process
Identifies DNS queries to known DNS over HTTPS (DoH) Providers by an unusual Microsoft signed binary or files from suspicious paths. This may indicate abuse of DoH for Command and Control communications.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Command & Control |
Rule body
[rule]
description = """
Identifies DNS queries to known DNS over HTTPS (DoH) Providers by an unusual Microsoft signed binary or files from
suspicious paths. This may indicate abuse of DoH for Command and Control communications.
"""
id = "9371a660-2ee8-4840-820d-8a9754308d53"
license = "Elastic License v2"
name = "DNS Over HTTPS by an Unusual Process"
os_list = ["windows"]
reference = ["https://www.blackhillsinfosec.com/dns-over-https-for-cobalt-strike/"]
version = "1.0.4"
query = '''
sequence by process.entity_id with maxspan=1m
[process where event.action == "start" and user.id like ("S-1-5-21*", "S-1-12-*") and
(
(process.executable : "C:\\Windows\\*.exe" and
process.code_signature.subject_name in ("Microsoft Windows Publisher", "Microsoft Corporation", "Microsoft Windows") and
not process.executable : ("C:\\Windows\\Sys?????\\ipconfig.exe",
"C:\\Windows\\Sys?????\\nslookup.exe",
"C:\\Windows\\Sys?????\\TRACERT.EXE",
"C:\\Windows\\Sys?????\\PING.EXE",
"C:\\Windows\\System32\\Microsoft-Edge-WebView\\msedgewebview2.exe")) or
(process.Ext.relative_file_creation_time <= 900 and process.code_signature.status in ("errorBadDigest", "errorUntrustedRoot")) or
(process.Ext.relative_file_creation_time <= 900 and process.executable : ("C:\\ProgramData\\*", "C:\\Users\\Public\\*", "C:\\Users\\*\\Downloads\\*"))
)
]
[dns where dns.question.name : ("cloudflare-dns.com", "mozilla.cloudflare-dns.com", "dns.google", "dns.quad9.net", "doh.opendns.com", "ordns.he.net") and
not (dns.question.name : "dns.google" and
process.executable : ("C:\\Program Files\\WindowsApps\\Enflick.TextNow-UnlimitedTextCalls_*\\app\\TextNow.exe",
"C:\\Program Files (x86)\\Steam\\steamapps\\common\\assettocorsa\\cache\\cef\\Assetto Corsa CEF.exe"))]
'''
min_endpoint_version = "8.4.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[[threat.technique.subtechnique]]
id = "T1071.004"
name = "DNS"
reference = "https://attack.mitre.org/techniques/T1071/004/"
[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[internal]
min_endpoint_version = "8.4.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.
Stage 1: process
[process where event.action == "start" and user.id like ("S-1-5-21*", "S-1-12-*") and
(
(process.executable : "C:\\Windows\\*.exe" and
process.code_signature.subject_name in ("Microsoft Windows Publisher", "Microsoft Corporation", "Microsoft Windows") and
not process.executable : ("C:\\Windows\\Sys?????\\ipconfig.exe",
"C:\\Windows\\Sys?????\\nslookup.exe",
"C:\\Windows\\Sys?????\\TRACERT.EXE",
"C:\\Windows\\Sys?????\\PING.EXE",
"C:\\Windows\\System32\\Microsoft-Edge-WebView\\msedgewebview2.exe")) or
(process.Ext.relative_file_creation_time <= 900 and process.code_signature.status in ("errorBadDigest", "errorUntrustedRoot")) or
(process.Ext.relative_file_creation_time <= 900 and process.executable : ("C:\\ProgramData\\*", "C:\\Users\\Public\\*", "C:\\Users\\*\\Downloads\\*"))
)
]
Stage 2: dns
[dns where dns.question.name : ("cloudflare-dns.com", "mozilla.cloudflare-dns.com", "dns.google", "dns.quad9.net", "doh.opendns.com", "ordns.he.net") and
not (dns.question.name : "dns.google" and
process.executable : ("C:\\Program Files\\WindowsApps\\Enflick.TextNow-UnlimitedTextCalls_*\\app\\TextNow.exe",
"C:\\Program Files (x86)\\Steam\\steamapps\\common\\assettocorsa\\cache\\cef\\Assetto Corsa CEF.exe"))]
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
dns.question.name | eq | dns.google | excludes:dns.question.name field:"dns.question.name" value:"dns.google" |
process.executable | wildcard | C:\Program Files\WindowsApps\Enflick.TextNow-UnlimitedTextCalls_*\app\TextNow.exe, C:\Program Files (x86)\Steam\steamapps\common\assettocorsa\cache\cef\Assetto Corsa CEF.exe | excludes:process.executable field:"process.executable" value:"C:\Program Files\WindowsApps\Enflick.TextNow-UnlimitedTextCalls_*\app\TextNow.exe" field:"process.executable" value:"C:\Program Files (x86)\Steam\steamapps\common\assettocorsa\cache\cef\Assetto Corsa CEF.exe" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dns.question.name | wildcard |
| field:"QueryName" kind:wildcard |
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.Ext.relative_file_creation_time | le |
| field:"process.Ext.relative_file_creation_time" kind:le value:"900" |
process.code_signature.status | in |
| field:"SignatureStatus" kind:in |
process.code_signature.subject_name | in |
| field:"Signature" kind:in |
process.executable | wildcard |
| field:"Image" kind:wildcard |
user.id | wildcard |
| field:"user.id" kind:wildcard |