Detection rules › Splunk

ngrok Execution - Windows (Sysmon)

Group by
_time, host
Source
github.com/anvilogic-forge/armory

Ngrok is a legitimate reverse proxy tool that can create a secure tunnel to servers located behind firewalls or on local machines that do not have a public IP. Ngrok has been leveraged by threat actors in several campaigns including use for lateral movement and data exfiltration. This use case detects process creation events for ngrok.exe or command patterns likely to be unique to ngrok in the event of a renamed executable

MITRE ATT&CK coverage

TacticTechniques
Command & Control

References

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 1: Process creation

Rule body

id: '20685.36866'
title: ngrok Execution - Windows
description: 'Ngrok is a legitimate reverse proxy tool that can create a secure tunnel
  to servers located behind firewalls or on local machines that do not have a public
  IP. Ngrok has been leveraged by threat actors in several campaigns including use
  for lateral movement and data exfiltration. This use case detects process creation
  events for ngrok.exe or command patterns likely to be unique to ngrok in the event
  of a renamed executable. -- Threat Actor Association: Scattered Spider (aka. Muddled
  Libra, Scatter Swine, Starfraud, UNC3944)'
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_sysmon` (TERM(EventCode=1) OR "<EventID>1<")
  TERM(ngrok) OR (TERM(start) "--all" "--config" ".yml") OR (TERM(tcp) ("139" OR "445"
  OR "3389" OR "5985" OR "5986")) | where match(process, "(?i)(tcp\s+(139|445|3389|5985|5986))|(\.exe\s+|(authtoken\s|start\s+--all))|(start\s.*\s--all\s.*\s--config\s.+\.yml)")
  OR match(process_path, "(?i)ngrok\.exe") | table _time, host, user, signature_id,
  process, process_*, parent_process_* | bin span=1s | stats values(*) as * by _time,
  host '
techniques:
- command-and-control:protocol tunneling
technique_id: 
- T1572
data_category:
- Windows Sysmon
- Process command-line parameters
references:
- https://www.logpoint.com/en/blog/a-deep-look-at-the-darkside-ransomware-operators-and-their-affiliates/

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_sysmon` (TERM(EventCode=1) OR "<EventID>1<") TERM(ngrok) OR (TERM(start) "--all" "--config" ".yml") OR (TERM(tcp) ("139" OR "445" OR "3389" OR "5985" OR "5986"))

Stage 2: where

| where match(process, "(?i)(tcp\s+(139|445|3389|5985|5986))|(\.exe\s+|(authtoken\s|start\s+--all))|(start\s.*\s--all\s.*\s--config\s.+\.yml)") OR match(process_path, "(?i)ngrok\.exe")

Stage 3: table

| table _time, host, user, signature_id, process, process_*, parent_process_*

Stage 4: bucket

| bin span=1s

Stage 5: stats

| stats values(*) as * by _time, host

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
EventCodeeq
  • 1 corpus 241 (splunk 225, kusto 15, elastic 1)
field:"EventID" kind:eq value:"1"
processregex_match
    • "(?i)(tcp\s+(139|445|3389|5985|5986))
    • (.exe\s+|(authtoken\s|start\s+--all))
    • (start\s.*\s--all\s.*\s--config\s.+.yml)"
    corpus 3 (splunk 3)
field:"CommandLine" kind:regex_match
process_pathregex_match
  • "(?i)ngrok.exe" corpus 3 (splunk 3)
field:"process_name" kind:regex_match

Search terms

These SPL tokens match against raw event text.

StageTerm
1"<EventID>1<"
1ngrok
1start
1"--all"
1"--config"
1".yml"
1tcp
1"139"
1"445"
1"3389"
1"5985"
1"5986"