Elastic medium stable kql

First Time Seen DNS Query to RMM Domain

Detects DNS queries to commonly abused remote monitoring and management (RMM) or remote access software domains from processes that are not browsers. Intended to surface RMM clients, scripts, or other non-browser activity contacting these services.

View Source

Detection Logic

FROM logs-endpoint.events.network-*, logs-windows.sysmon_operational-* METADATA _index
| WHERE host.os.type == "windows"
    
AND event.category == "network"
    
AND event.action in ("lookup_requested", "DNSEvent (DNS query)")
    
AND dns.question.name IS NOT NULL

// Exclude browser processes
| WHERE NOT
    process.name IN (
        "chrome.exe", "msedge.exe", "MicrosoftEdge.exe", "MicrosoftEdgeCP.exe",
        "firefox.exe", "iexplore.exe", "safari.exe", "brave.exe",
        "opera.exe", "vivaldi.exe", "msedgewebview2.exe"
    )

// Extract the parent domain (last two labels, e.g. example.com)
| GROK dns.question.name """(?:[^.]+\.)+(?<parent_domain>[^.]+\.[^.]+)$"""
| EVAL parent_domain = COALESCE(parent_domain, dns.question.name)

// Known RMM parent domains, add or remove entries here as your environment changes.
| WHERE parent_domain IN (
    "01com.com",
    "247ithelp.com",
    "action1.com",
    "addigy.com",
    "aeroadmin.com",
    "ammyy.com",
    "anydesk.com",
    "anyplace-control.com",
    "anysupport.net",
    "atera.com",
    "aurelius.host",
    "auvik.com",
    "aweray.com",
    "aweray.net",
    "backdrop.cloud",
    "barracudamsp.com",
    "beamyourscreen.com",
    "beanywhere.com",
    "beinsync.com",
    "beinsync.net",
    "beyondtrustcloud.com",
    "bomgar.com",
    "bomgarcloud.com",
    "centrastage.net",
    "centuriontech.com",
    "connectwise.com",
    "crossloop.com",
    "dameware.com",
    "datto.com",
    "datto.net",
    "deskday.ai",
    "deskroll.com",
    "desktopstreaming.com",
    "distantdesktop.com",
    "donkz.nl",
    "dwservice.net",
    "ehorus.com",
    "electric.ai",
    "emcosoftware.com",
    "ericom.com",
    "fastsupport.com",
    "fastviewer.com",
    "fixme.it",
    "fleetdeck.io",
    "gatherplace.com",
    "gatherplace.net",
    "getgo.com",
    "getscreen.me",
    "gotoassist.at",
    "gotoassist.com",
    "gotoassist.me",
    "gotohttp.com",
    "gotoresolve.com",
    "goverlan.com",
    "heartbeatrm.com",
    "helpme.net",
    "helpwire.app",
    "hoptodesk.com",
    "hostedrmm.com",
    "immy.bot",
    "immybot.com",
    "imperosoftware.com",
    "instanthousecall.com",
    "instanthousecall.net",
    "intelliadmin.com",
    "internapcdn.net",
    "internetid.ru",
    "iperius-rs.com",
    "iperius.net",
    "iperiusremote.com",
    "islonline.com",
    "islonline.net",
    "itarian.com",
    "itsupport247.net",
    "jumpcloud.com",
    "jumpdesktop.com",
    "jumpto.me",
    "kabuto.io",
    "kabutoservices.com",
    "kaseya.com",
    "kaseya.net",
    "kickidler.com",
    "laplink.com",
    "level.io",
    "liongard.com",
    "litemanager.com",
    "litemanager.ru",
    "logicnow.com",
    "logmein-gateway.com",
    "logmein.com",
    "logmeininc.com",
    "logmeinrescue.com",
    "logmeinrescue.eu",
    "lunixar.com",
    "meshcentral.com",
    "mikogo.com",
    "mikogo4.com",
    "miradore.com",
    "msp360.com",
    "mygreenpc.com",
    "n-able.com",
    "naverisk.com",
    "nchuser.com",
    "netop.com",
    "netsupportmanager.com",
    "netsupportsoftware.com",
    "netviewer.com",
    "ninjaone.com",
    "ninjarmm.com",
    "ninjarmm.net",
    "nomachine.com",
    "ntrsupport.com",
    "opti-tune.com",
    "optitune.us",
    "oray.com",
    "oray.net",
    "panorama9.com",
    "parsec.app",
    "parsecusercontent.com",
    "pcvisit.de",
    "pilixo.com",
    "playanext.com",
    "pulseway.com",
    "qetqo.com",
    "r-hud.net",
    "real-time-collaboration.com",
    "remmon.hu",
    "remote.it",
    "remote.management",
    "remotecall.com",
    "remotedesktop.com",
    "remotepc.com",
    "remotetopc.com",
    "remoteutilities.com",
    "remotix.com",
    "remotly.com",
    "repairshopr.com",
    "rmansys.ru",
    "rmmservice.ca",
    "rmmservice.eu",
    "royalapps.com",
    "rport.io",
    "rudesktop.ru",
    "rustdesk.com",
    "rview.com",
    "screenconnect.com",
    "screenmeet.com",
    "scrn.mt",
    "servably.com",
    "server-eye.de",
    "set.me",
    "setme.net",
    "showmypc.com",
    "signalserver.xyz",
    "simple-help.com",
    "skyfex.com",
    "sorillus.com",
    "splashtop.com",
    "splashtop.eu",
    "spyanywhere.com",
    "spytech-web.com",
    "startsupport.com",
    "superops.ai",
    "superops.com",
    "superopsalpha.com",
    "superopsbeta.com",
    "supremocontrol.com",
    "swi-rc.com",
    "swi-tc.com",
    "syncroapi.com",
    "syncromsp.com",
    "syspectr.com",
    "system-monitor.com",
    "systemmonitor.us",
    "tacticalrmm.com",
    "tailscale.com",
    "teamviewer.com",
    "techinline.net",
    "tele-desk.com",
    "tiflux.com",
    "tightvnc.com",
    "tmate.io",
    "todesk.com",
    "twingate.com",
    "ultraviewer.net",
    "ultravnc.com",
    "vnc.com",
    "weezo.me",
    "weezo.net",
    "xeox.com",
    "zoho.eu",
    "zohoassist.com",
    "zohoassist.jp"
)

// Aggregate by parent domain and get 1st time seen timestamp as well as unique count of agents
| STATS
    event_count = COUNT(*),
    Esql.first_time_seen = MIN(@timestamp),
    Esql.count_distinct_host_id = COUNT_DISTINCT(host.id),
    Esql.process_executable_values = VALUES(process.executable),
    Esql.dns_question_name_values = VALUES(dns.question.name),
    Esql.host_name_values = VALUES(host.name),
    Esql.host_id_values = VALUES(host.id),
    Esql.user_name_values = VALUES(user.name),
    Esql.user_id_values = VALUES(user.id),
    Esql.namespace_values = VALUES(data_stream.namespace) BY parent_domain

// Calculate the time difference between first time seen and rule execution time
| eval Esql.recent = DATE_DIFF("minute", Esql.first_time_seen, now())

// First time seen is within 6m of the rule execution time and first seen in the last 5 days as per the rule from schedule and limited to 1 unique host
| where Esql.recent <= 6 and Esql.count_distinct_host_id == 1

// populate fields for rule exception and triage
| eval host.name = MV_FIRST(Esql.host_name_values),
       host.id = MV_FIRST(Esql.host_id_values),
       user.name = MV_FIRST(Esql.user_name_values),
       user.id = MV_FIRST(Esql.user_id_values),
       data_stream.namespace = MV_FIRST(Esql.namespace_values),
       process.executable = MV_FIRST(Esql.process_executable_values),
       dns.question.name = MV_FIRST(Esql.dns_question_name_values)
| keep host.name, host.id, user.name, user.id, data_stream.namespace, process.executable, dns.question.name, Esql.*

Field Validations

Loading…

Comments (0)

Loading comments...