Ngrok Reverse Proxy on Network
Description
This analytic detects DNS lookups to ngrok-managed endpoint domains, agent gateway domains, and CNAME targets, plus a CISA-reported ngrok-themed domain. Results classify TCP tunnel hostnames, tunnel.us-style agent gateway lookups, and generated-looking endpoint labels, and summarize repeated queries and distinct DNS answers by source and 15-minute interval. Threat actors have used ngrok to expose internal services, including RDP and SMB, maintain persistence, move laterally, and proxy command-and-control traffic. Ngrok is also a legitimate developer and remote-access service, so use the query classification, frequency, endpoint context, and approved usage baseline to prioritize investigation.
Query · spl
| tstats `security_content_summariesonly`
count min(_time) as firstTime
max(_time) as lastTime
values(DNS.answer) as answer
distinct_count(DNS.answer) as distinct_answers
values(DNS.answer_count) as answer_count
values(DNS.query_count) as query_count
FROM datamodel=Network_Resolution WHERE
DNS.query IN (
"*.ngrok-agent.com.",
"*.ngrok-agent.com",
"*.ngrok-cname.com.",
"*.ngrok-cname.com",
"*.ngrok-free.app.",
"*.ngrok-free.app",
"*.ngrok-free.dev.",
"*.ngrok-free.dev",
"*.ngrok-free.pizza.",
"*.ngrok-free.pizza",
"*.ngrok.app.",
"*.ngrok.app",
"*.ngrok.com.",
"*.ngrok.com",
"*.ngrok.dev.",
"*.ngrok.dev",
"*.ngrok.io.",
"*.ngrok.io",
"*.ngrok.pizza.",
"*.ngrok.pizza",
"*.ngrok.pro.",
"*.ngrok.pro",
"*.tcp.ngrok.io.",
"*.tcp.ngrok.io",
"korgn.su.lennut.com.",
"korgn.su.lennut.com",
"tunnel.*.ngrok.com.",
"tunnel.*.ngrok.com"
)
BY DNS.src DNS.query DNS.reply_code_id DNS.vendor_product _time span=15m
| `drop_dm_object_name("DNS")`
| eval query = lower(rtrim(query, "."))
| eval endpoint_label = mvindex(split(query, "."), 0)
| eval query_type = case(
query = "korgn.su.lennut.com", "CISA-reported ngrok-themed domain",
match(query, "(?i)^[^.]+\\.tcp\\.ngrok\\.io$"), "TCP tunnel endpoint",
match(query, "(?i)^tunnel\\.[^.]+\\.ngrok\\.com$"), "Ngrok agent gateway",
match(endpoint_label, "(?i)^(?:[0-9]{8,}|[a-f0-9]{10,})$"), "Generated-looking endpoint label",
true(), "Ngrok-managed domain lookup"
)
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `ngrok_reverse_proxy_on_network_filter`
Implementation guide
This detection requires DNS query logs. Map your DNS telemetry (for example, from your DNS server, resolver, or network sensor) to the Network Resolution data model so the search can find the events it needs. The search groups matching DNS lookups by source, query, response code, vendor, and 15-minute interval. Ensure the Network Resolution data model includes DNS query names and answers to populate query classification and distinct-answer counts. Modify the query as needed to use another source.
Known false positives
- Ngrok-managed domains and the tunnel gateway are used for legitimate development, testing, and remote-access workflows. Static dev domains and repeated agent gateway lookups can be expected in approved environments. Baseline authorized sources and use, and prioritize TCP tunnel endpoints, generated-looking labels, and the CISA-reported domain.
Analyst notes
Known false positives: Ngrok-managed domains and the tunnel gateway are used for legitimate development, testing, and remote-access workflows. Static dev domains and repeated agent gateway lookups can be expected in approved environments. Baseline authorized sources and use, and prioritize TCP tunnel endpoints, generated-looking labels, and the CISA-reported domain.