Detection rules › Elastic
Curl to Telegram API
Detects when curl is used to access a Telegram API or web endpoint. Several malware samples have been observed utilizing Telegram as a C2, payload delivery, and domain rotation channel, including via t.me bot URLs.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Command & Control |
Telemetry coverage
Rule body
[rule]
description = """
Detects when curl is used to access a Telegram API or web endpoint. Several malware samples have been observed utilizing
Telegram as a C2, payload delivery, and domain rotation channel, including via t.me bot URLs.
"""
id = "479a2a9e-caba-43ea-b28b-88b1b242edd2"
license = "Elastic License v2"
name = "Curl to Telegram API"
os_list = ["macos"]
version = "1.0.6"
query = '''
sequence by process.entity_id with maxspan=15s
[process where event.type == "start" and event.action == "exec" and
process.name in ("curl", "nscurl") and
not (process.parent.name == "Telegram" or process.Ext.effective_parent.name == "Telegram")]
[network where event.type == "start" and process.name in ("curl", "nscurl") and destination.domain in ("api.telegram.org", "api.telegram.org.", "t.me", "t.me.")]
'''
min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[[threat.technique.subtechnique]]
id = "T1071.001"
name = "Web Protocols"
reference = "https://attack.mitre.org/techniques/T1071/001/"
[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[internal]
min_endpoint_version = "8.16.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 15s, correlated by process.entity_id.
Stage 1: process
[process where event.type == "start" and event.action == "exec" and
process.name in ("curl", "nscurl") and
not (process.parent.name == "Telegram" or process.Ext.effective_parent.name == "Telegram")]
Stage 2: network
[network where event.type == "start" and process.name in ("curl", "nscurl") and destination.domain in ("api.telegram.org", "api.telegram.org.", "t.me", "t.me.")]
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.Ext.effective_parent.name | eq | Telegram | excludes:process.Ext.effective_parent.name field:"process.Ext.effective_parent.name" value:"Telegram" |
process.parent.name | eq | Telegram | excludes:process.parent.name field:"process.parent.name" value:"Telegram" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.domain | in |
| field:"DestinationHostname" kind:in |
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | in |
| field:"process_name" kind:in |