Detection rules › Elastic

DNS Over HTTPS by an Unusual Process

Time window
1m
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

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

TacticTechniques
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.

FieldKindExcluded valuesSearch
dns.question.nameeqdns.googleexcludes:dns.question.name field:"dns.question.name" value:"dns.google"
process.executablewildcardC:\Program Files\WindowsApps\Enflick.TextNow-UnlimitedTextCalls_*\app\TextNow.exe, C:\Program Files (x86)\Steam\steamapps\common\assettocorsa\cache\cef\Assetto Corsa CEF.exeexcludes: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.

FieldKindValuesSearch
dns.question.namewildcard
  • cloudflare-dns.com
  • dns.google
  • dns.quad9.net
  • doh.opendns.com
  • mozilla.cloudflare-dns.com
  • ordns.he.net
field:"QueryName" kind:wildcard
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
process.Ext.relative_file_creation_timele
  • 900 transforms: number corpus 7 (elastic 7)
field:"process.Ext.relative_file_creation_time" kind:le value:"900"
process.code_signature.statusin
  • errorBadDigest corpus 2 (elastic 2)
  • errorUntrustedRoot
field:"SignatureStatus" kind:in
process.code_signature.subject_namein
  • Microsoft Corporation corpus 2 (elastic 2)
  • Microsoft Windows corpus 3 (elastic 3)
  • Microsoft Windows Publisher
field:"Signature" kind:in
process.executablewildcard
  • C:\ProgramData\*
  • C:\Users\*\Downloads\* corpus 2 (elastic 2)
  • C:\Users\Public\* corpus 2 (sigma 1, elastic 1)
  • C:\Windows\*.exe corpus 2 (elastic 2)
field:"Image" kind:wildcard
user.idwildcard
  • S-1-12-* corpus 46 (elastic 46)
  • S-1-5-21* corpus 47 (elastic 47)
field:"user.id" kind:wildcard