Linux Telegram API Request
This rule detects when a process executes the curl or wget command with an argument that includes the api.telegram.org domain. This may indicate command and control behavior.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2025/04/29"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2025/04/29"
6
7[rule]
8author = ["Elastic"]
9description = """
10This rule detects when a process executes the curl or wget command with an argument that includes the
11api.telegram.org domain. This may indicate command and control behavior.
12"""
13from = "now-9m"
14index = ["logs-endpoint.events.process*"]
15language = "eql"
16license = "Elastic License v2"
17name = "Linux Telegram API Request"
18risk_score = 21
19rule_id = "af1e36fe-0abd-4463-b5ec-4e276dec0b26"
20setup = """## Setup
21
22This rule requires data coming in from Elastic Defend.
23
24### Elastic Defend Integration Setup
25Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
26
27#### Prerequisite Requirements:
28- Fleet is required for Elastic Defend.
29- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
30
31#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
32- Go to the Kibana home page and click "Add integrations".
33- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
34- Click "Add Elastic Defend".
35- Configure the integration name and optionally add a description.
36- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
37- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
38- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
39- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
40For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
41- Click "Save and Continue".
42- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
43For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
44
45Elastic Defend integration does not collect environment variable logging by default.
46In order to capture this behavior, this rule requires a specific configuration option set within the advanced settings of the Elastic Defend integration.
47 #### To set up environment variable capture for an Elastic Agent policy:
48- Go to “Security → Manage → Policies”.
49- Select an “Elastic Agent policy”.
50- Click “Show advanced settings”.
51- Scroll down or search for “linux.advanced.capture_env_vars”.
52- Enter the names of environment variables you want to capture, separated by commas.
53- For this rule the linux.advanced.capture_env_vars variable should be set to "HTTP_PROXY,HTTPS_PROXY,ALL_PROXY".
54- Click “Save”.
55After saving the integration change, the Elastic Agents running this policy will be updated and the rule will function properly.
56For more information on capturing environment variables refer to the [helper guide](https://www.elastic.co/guide/en/security/current/environment-variable-capture.html).
57"""
58severity = "low"
59tags = [
60 "Domain: Endpoint",
61 "OS: Linux",
62 "Use Case: Threat Detection",
63 "Tactic: Command and Control",
64 "Data Source: Elastic Defend",
65]
66timestamp_override = "event.ingested"
67type = "eql"
68query = '''
69process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
70process.name in ("curl", "wget") and process.command_line like "*api.telegram.org*"
71'''
72
73[[rule.threat]]
74framework = "MITRE ATT&CK"
75
76 [rule.threat.tactic]
77 name = "Command and Control"
78 id = "TA0011"
79 reference = "https://attack.mitre.org/tactics/TA0011/"
80
81 [[rule.threat.technique]]
82 name = "Application Layer Protocol"
83 id = "T1071"
84 reference = "https://attack.mitre.org/techniques/T1071/"
85
86 [[rule.threat.technique.subtechnique]]
87 name = "Web Protocols"
88 id = "T1071.001"
89 reference = "https://attack.mitre.org/techniques/T1071/001/"
Related rules
- Suspicious Named Pipe Creation
- Git Repository or File Download to Suspicious Directory
- Potential Linux Tunneling and/or Port Forwarding via SSH Option
- High Number of Egress Network Connections from Unusual Executable
- Potential Malware-Driven SSH Brute Force Attempt