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.

Raw source Ngrok Reverse Proxy on Network · SPL
Esc
Published by splunk/security_content ↗, licensed under Apache 2.0 ↗. Reproduced here unmodified.
name: Ngrok Reverse Proxy on Network
id: 5790a766-53b8-40d3-a696-3547b978fcf0
version: 11
creation_date: '2022-11-16'
modification_date: '2026-11-13'
author: Michael Haag, Nasreddine Bencherchali, Splunk
status: production
type: Anomaly
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.
data_source:
    - Sysmon EventID 22
search: |-
    | 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`
how_to_implement: |-
    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.
references:
    - https://ngrok.com/docs/gateway/domains
    - https://ngrok.com/docs/gateway/domains/custom-domains
    - https://ngrok.com/docs/gateway/agent/cli
    - https://attack.mitre.org/software/S0508/
    - https://www.cisa.gov/uscert/sites/default/files/publications/aa22-320a_joint_csa_iranian_government-sponsored_apt_actors_compromise_federal%20network_deploy_crypto%20miner_credential_harvester.pdf
    - https://www.cisa.gov/sites/default/files/2024-08/aa24-241a-iran-based-cyber-actors-enabling-ransomware-attacks-on-us-organizations_0.pdf
    - https://www.trendmicro.com/en_us/research/24/j/earth-simnavaz-cyberattacks.html
    - https://www.microsoft.com/en-us/security/blog/2023/06/14/cadet-blizzard-emerges-as-a-novel-and-distinct-russian-threat-actor/
    - https://thedfirreport.com/2024/08/12/threat-actors-toolkit-leveraging-sliver-poshc2-batch-scripts/
    - https://github.com/benyG/Invoke-Ngrok
    - https://www.sophos.com/en-us/blog/rapid-response-the-ngrok-incident-guide
drilldown_searches:
    - name: View the detection results for - "$src$"
      search: '%original_detection_search% | search  src = "$src$"'
      earliest_offset: $info_min_time$
      latest_offset: $info_max_time$
    - name: View risk events for the last 7 days for - "$src$"
      search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$src$") | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
      earliest_offset: 7d
      latest_offset: "0"
intermediate_findings:
    entities:
        - field: src
          type: system
          score: 20
          message: The endpoint [$src$] queried Ngrok-related domain [$query$] ($query_type$) $count$ time(s) and received $distinct_answers$ distinct DNS answer(s).
analytic_story:
    - Reverse Network Proxy
    - CISA AA22-320A
    - CISA AA24-241A
asset_type: Endpoint
mitre_attack_id:
    - T1572
    - T1090
    - T1102
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: network
security_domain: network
tests:
    - name: True Positive Test
      attack_data:
        - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1572/ngrok/windows-sysmon.log
          source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational
          sourcetype: XmlWinEventLog
      test_type: unit

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.