Ngrok Reverse Proxy on Network

Original Source: [splunk source]
Name:Ngrok Reverse Proxy on Network
id:5790a766-53b8-40d3-a696-3547b978fcf0
version:3
date:2024-09-30
author:Michael Haag, Splunk
status:production
type:Anomaly
Description:The following analytic detects DNS queries to common Ngrok domains, indicating potential use of the Ngrok reverse proxy tool. It leverages the Network Resolution datamodel to identify queries to domains such as "*.ngrok.com" and "*.ngrok.io". While Ngrok usage is not inherently malicious, it has been increasingly adopted by adversaries for covert communication and data exfiltration. If confirmed malicious, this activity could allow attackers to bypass network defenses, establish persistent connections, and exfiltrate sensitive data, posing a significant threat to the network's security.
Data_source:
  • -Sysmon EventID 22
search:| tstats `security_content_summariesonly` count min(_time) as firstTime max(_time) as lastTime from datamodel=Network_Resolution where DNS.query IN ("*.ngrok.com","*.ngrok.io", "ngrok.*.tunnel.com", "korgn.*.lennut.com") by DNS.src DNS.query DNS.answer
| `drop_dm_object_name("DNS")`
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `ngrok_reverse_proxy_on_network_filter`


how_to_implement:The Network Resolution Datamodel will need to have data mapped to it regarding DNS queries. Modify query as needed to use another source.
known_false_positives:False positives will be present based on organizations that allow the use of Ngrok. Filter or monitor as needed.
References:
  -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
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$") starthoursago=168 | 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:'$info_min_time$'
latest_offset:'$info_max_time$'
tags:
  analytic_story:
    - 'Reverse Network Proxy'
    - 'CISA AA22-320A'
    - 'CISA AA24-241A'
  asset_type:Endpoint
  confidence:100
  impact:50
  message:An endpoint, $src$, is beaconing out to the reverse proxy service of Ngrok.
  mitre_attack_id:
    - 'T1572'
    - 'T1090'
    - 'T1102'
  observable:
    name:'src'
    type:'Hostname'
    - role:
      - 'Victim'
  product:
    - 'Splunk Enterprise'
    - 'Splunk Enterprise Security'
    - 'Splunk Cloud'
  required_fields:
    - 'DNS.src'
    - 'DNS.query'
    - 'DNS.answer'
  risk_score:50
  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
  update_timestamp: True
manual_test:None