Skip to content

Commit 758e155

Browse files
[New Rule] High Number of Egress Network Connections from Unusual Executable (#4473)
* [New Rule] High Number of Egress Network Connections from Unusual Executable * Update command_and_control_frequent_egress_netcon_from_sus_executable.toml * Update rules/linux/command_and_control_frequent_egress_netcon_from_sus_executable.toml * Update command_and_control_frequent_egress_netcon_from_sus_executable.toml * Update command_and_control_frequent_egress_netcon_from_sus_executable.toml --------- Co-authored-by: shashank-elastic <[email protected]>
1 parent 8a22132 commit 758e155

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
[metadata]
2+
creation_date = "2025/02/20"
3+
integration = ["endpoint"]
4+
maturity = "production"
5+
min_stack_comments = "ES|QL rule type in technical preview as of 8.13"
6+
min_stack_version = "8.13.0"
7+
updated_date = "2025/02/20"
8+
9+
[rule]
10+
author = ["Elastic"]
11+
description = """
12+
This rule detects a high number of egress network connections from an unusual executable on a Linux system.
13+
This could indicate a command and control (C2) communication attempt, a brute force attack via a malware
14+
infection, or other malicious activity. ES|QL rules have limited fields available in its alert documents.
15+
Make sure to review the original documents to aid in the investigation of this alert.
16+
"""
17+
from = "now-61m"
18+
interval = "1h"
19+
language = "esql"
20+
license = "Elastic License v2"
21+
name = "High Number of Egress Network Connections from Unusual Executable"
22+
risk_score = 47
23+
rule_id = "1fa350e0-0aa2-4055-bf8f-ab8b59233e59"
24+
setup = """## Setup
25+
26+
This rule requires data coming in from Elastic Defend.
27+
28+
### Elastic Defend Integration Setup
29+
Elastic 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.
30+
31+
#### Prerequisite Requirements:
32+
- Fleet is required for Elastic Defend.
33+
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
34+
35+
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
36+
- Go to the Kibana home page and click "Add integrations".
37+
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
38+
- Click "Add Elastic Defend".
39+
- Configure the integration name and optionally add a description.
40+
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
41+
- 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).
42+
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
43+
- 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.
44+
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
45+
- Click "Save and Continue".
46+
- 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.
47+
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
48+
"""
49+
severity = "medium"
50+
tags = [
51+
"Domain: Endpoint",
52+
"OS: Linux",
53+
"Use Case: Threat Detection",
54+
"Tactic: Command and Control",
55+
"Data Source: Elastic Defend",
56+
]
57+
timestamp_override = "event.ingested"
58+
type = "esql"
59+
query = '''
60+
from logs-endpoint.events.network-*
61+
| keep @timestamp, host.os.type, event.type, event.action, process.name, process.executable, destination.ip, agent.id
62+
| where @timestamp > now() - 1 hours
63+
| where host.os.type == "linux" and event.type == "start" and event.action == "connection_attempted" and (
64+
(
65+
process.executable like "/tmp/*" or
66+
process.executable like "/var/tmp/*" or
67+
process.executable like "/dev/shm/*"
68+
) or
69+
(process.name like ".*")
70+
) and not (
71+
CIDR_MATCH(
72+
destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29", "192.0.0.8/32", "192.0.0.9/32",
73+
"192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24", "192.31.196.0/24", "192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24",
74+
"224.0.0.0/4", "100.64.0.0/10", "192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "224.0.0.0/4", "240.0.0.0/4", "::1",
75+
"FE80::/10", "FF00::/8"
76+
) or
77+
process.executable like "/nix/store/*" or
78+
process.executable like "/tmp/newroot/*" or
79+
process.executable like "/tmp/.mount*" or
80+
process.executable like "/tmp/go-build*"
81+
)
82+
| stats cc = count(), agent_count = count_distinct(agent.id) by process.executable
83+
| where agent_count == 1 and cc > 15
84+
| sort cc asc
85+
| limit 100
86+
'''
87+
88+
[[rule.threat]]
89+
framework = "MITRE ATT&CK"
90+
91+
[[rule.threat.technique]]
92+
id = "T1071"
93+
name = "Application Layer Protocol"
94+
reference = "https://attack.mitre.org/techniques/T1071/"
95+
96+
[rule.threat.tactic]
97+
id = "TA0011"
98+
name = "Command and Control"
99+
reference = "https://attack.mitre.org/tactics/TA0011/"

0 commit comments

Comments
 (0)