Skip to content

Commit 59473f0

Browse files
authored
[New Rule] Potential Malware-Driven SSH Brute Force Attempt (#4474)
* [New Rule] Potential Malware-Driven SSH Brute Force Attempt * Update impact_potential_bruteforce_malware_infection.toml * Update rules/linux/impact_potential_bruteforce_malware_infection.toml * Update impact_potential_bruteforce_malware_infection.toml
1 parent 758e155 commit 59473f0

File tree

1 file changed

+124
-0
lines changed

1 file changed

+124
-0
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
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 detection identifies a Linux host that has potentially been infected with malware and is being used to conduct
13+
brute-force attacks against external systems over SSH (port 22 and common alternative SSH ports). The detection
14+
looks for a high volume of outbound connection attempts to non-private IP addresses from a single process. A
15+
compromised host may be part of a botnet or controlled by an attacker, attempting to gain unauthorized access
16+
to remote systems. This behavior is commonly observed in SSH brute-force campaigns where malware hijacks
17+
vulnerable machines to expand its attack surface. ES|QL rules have limited fields available in its alert documents.
18+
Make sure to review the original documents to aid in the investigation of this alert.
19+
"""
20+
from = "now-61m"
21+
interval = "1h"
22+
language = "esql"
23+
license = "Elastic License v2"
24+
name = "Potential Malware-Driven SSH Brute Force Attempt"
25+
risk_score = 47
26+
rule_id = "77122db4-5876-4127-b91b-6c179eb21f88"
27+
setup = """## Setup
28+
29+
This rule requires data coming in from Elastic Defend.
30+
31+
### Elastic Defend Integration Setup
32+
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.
33+
34+
#### Prerequisite Requirements:
35+
- Fleet is required for Elastic Defend.
36+
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
37+
38+
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
39+
- Go to the Kibana home page and click "Add integrations".
40+
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
41+
- Click "Add Elastic Defend".
42+
- Configure the integration name and optionally add a description.
43+
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
44+
- 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).
45+
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
46+
- 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.
47+
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).
48+
- Click "Save and Continue".
49+
- 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.
50+
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
51+
"""
52+
severity = "medium"
53+
tags = [
54+
"Domain: Endpoint",
55+
"OS: Linux",
56+
"Use Case: Threat Detection",
57+
"Tactic: Impact",
58+
"Tactic: Execution",
59+
"Tactic: Command and Control",
60+
"Data Source: Elastic Defend",
61+
]
62+
timestamp_override = "event.ingested"
63+
type = "esql"
64+
query = '''
65+
from logs-endpoint.events.network-*
66+
| keep @timestamp, host.os.type, event.type, event.action, destination.port, process.executable, destination.ip, agent.id
67+
| where @timestamp > now() - 1 hours
68+
| where host.os.type == "linux" and event.type == "start" and event.action == "connection_attempted" and
69+
destination.port in (22, 222, 2222, 10022, 2022, 2200, 62612, 8022) and not
70+
CIDR_MATCH(
71+
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",
72+
"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",
73+
"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",
74+
"FE80::/10", "FF00::/8"
75+
)
76+
| stats cc = count(), agent_count = count_distinct(agent.id) by process.executable, destination.port
77+
| where agent_count == 1 and cc > 15
78+
| sort cc asc
79+
| limit 100
80+
'''
81+
82+
[[rule.threat]]
83+
framework = "MITRE ATT&CK"
84+
85+
[rule.threat.tactic]
86+
name = "Impact"
87+
id = "TA0040"
88+
reference = "https://attack.mitre.org/tactics/TA0040/"
89+
90+
[[rule.threat.technique]]
91+
name = "Resource Hijacking"
92+
id = "T1496"
93+
reference = "https://attack.mitre.org/techniques/T1496/"
94+
95+
[[rule.threat]]
96+
framework = "MITRE ATT&CK"
97+
98+
[rule.threat.tactic]
99+
name = "Execution"
100+
id = "TA0002"
101+
reference = "https://attack.mitre.org/tactics/TA0002/"
102+
103+
[[rule.threat.technique]]
104+
name = "Command and Scripting Interpreter"
105+
id = "T1059"
106+
reference = "https://attack.mitre.org/techniques/T1059/"
107+
108+
[[rule.threat.technique.subtechnique]]
109+
name = "Unix Shell"
110+
id = "T1059.004"
111+
reference = "https://attack.mitre.org/techniques/T1059/004/"
112+
113+
[[rule.threat]]
114+
framework = "MITRE ATT&CK"
115+
116+
[rule.threat.tactic]
117+
id = "TA0011"
118+
name = "Command and Control"
119+
reference = "https://attack.mitre.org/tactics/TA0011/"
120+
121+
[[rule.threat.technique]]
122+
id = "T1071"
123+
name = "Application Layer Protocol"
124+
reference = "https://attack.mitre.org/techniques/T1071/"

0 commit comments

Comments
 (0)