Potential External Linux SSH Brute Force Detected
Identifies multiple external consecutive login failures targeting a user account from the same source address within a short time interval. Adversaries will often brute force login attempts across multiple users with a common or known password, in an attempt to gain access to these accounts.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2022/09/14"
3integration = ["system"]
4maturity = "production"
5updated_date = "2024/05/21"
6
7[rule]
8author = ["Elastic"]
9description = """
10Identifies multiple external consecutive login failures targeting a user account from the same source address within a
11short time interval. Adversaries will often brute force login attempts across multiple users with a common or known
12password, in an attempt to gain access to these accounts.
13"""
14from = "now-9m"
15index = ["filebeat-*", "logs-system.auth-*"]
16language = "eql"
17license = "Elastic License v2"
18max_signals = 5
19name = "Potential External Linux SSH Brute Force Detected"
20note = """## Triage and analysis
21
22### Investigating Potential External Linux SSH Brute Force Detected
23
24The rule identifies consecutive SSH login failures targeting a user account from the same source IP address to the same target host indicating brute force login attempts.
25
26This rule will generate a lot of noise for systems with a front-facing SSH service, as adversaries scan the internet for remotely accessible SSH services and try to brute force them to gain unauthorized access.
27
28In case this rule generates too much noise and external brute forcing is of not much interest, consider turning this rule off and enabling "Potential Internal Linux SSH Brute Force Detected" to detect internal brute force attempts.
29
30#### Possible investigation steps
31
32- Investigate the login failure user name(s).
33- Investigate the source IP address of the failed ssh login attempt(s).
34- Investigate other alerts associated with the user/host during the past 48 hours.
35- Identify the source and the target computer and their roles in the IT environment.
36
37### False positive analysis
38
39- Authentication misconfiguration or obsolete credentials.
40- Service account password expired.
41- Infrastructure or availability issue.
42
43### Related Rules
44
45- Potential Internal Linux SSH Brute Force Detected - 1c27fa22-7727-4dd3-81c0-de6da5555feb
46- Potential SSH Password Guessing - 8cb84371-d053-4f4f-bce0-c74990e28f28
47
48### Response and remediation
49
50- Initiate the incident response process based on the outcome of the triage.
51- Isolate the involved hosts to prevent further post-compromise behavior.
52- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
53- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
54- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
55- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
56"""
57risk_score = 21
58rule_id = "fa210b61-b627-4e5e-86f4-17e8270656ab"
59setup = """## Setup
60
61This rule requires data coming in from Filebeat.
62
63### Filebeat Setup
64Filebeat is a lightweight shipper for forwarding and centralizing log data. Installed as an agent on your servers, Filebeat monitors the log files or locations that you specify, collects log events, and forwards them either to Elasticsearch or Logstash for indexing.
65
66#### The following steps should be executed in order to add the Filebeat on a Linux System:
67- Elastic provides repositories available for APT and YUM-based distributions. Note that we provide binary packages, but no source packages.
68- To install the APT and YUM repositories follow the setup instructions in this [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/setup-repositories.html).
69- To run Filebeat on Docker follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/running-on-docker.html).
70- To run Filebeat on Kubernetes follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/running-on-kubernetes.html).
71- For quick start information for Filebeat refer to the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/8.11/filebeat-installation-configuration.html).
72- For complete “Setup and Run Filebeat” information refer to the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/setting-up-and-running.html).
73
74#### Rule Specific Setup Note
75- This rule requires the “Filebeat System Module” to be enabled.
76- The system module collects and parses logs created by the system logging service of common Unix/Linux based distributions.
77- To run the system module of Filebeat on Linux follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-system.html).
78"""
79severity = "low"
80tags = ["Domain: Endpoint", "OS: Linux", "Use Case: Threat Detection", "Tactic: Credential Access"]
81type = "eql"
82
83query = '''
84sequence by host.id, source.ip, user.name with maxspan=15s
85 [ authentication where host.os.type == "linux" and
86 event.action in ("ssh_login", "user_login") and event.outcome == "failure" and
87 not cidrmatch(source.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",
88 "192.0.0.0/29", "192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32",
89 "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", "224.0.0.0/4",
90 "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", "240.0.0.0/4",
91 "::1", "FE80::/10", "FF00::/8") ] with runs = 10
92'''
93
94
95[[rule.threat]]
96framework = "MITRE ATT&CK"
97[[rule.threat.technique]]
98id = "T1110"
99name = "Brute Force"
100reference = "https://attack.mitre.org/techniques/T1110/"
101[[rule.threat.technique.subtechnique]]
102id = "T1110.001"
103name = "Password Guessing"
104reference = "https://attack.mitre.org/techniques/T1110/001/"
105
106[[rule.threat.technique.subtechnique]]
107id = "T1110.003"
108name = "Password Spraying"
109reference = "https://attack.mitre.org/techniques/T1110/003/"
110
111
112
113[rule.threat.tactic]
114id = "TA0006"
115name = "Credential Access"
116reference = "https://attack.mitre.org/tactics/TA0006/"
Triage and analysis
Investigating Potential External Linux SSH Brute Force Detected
The rule identifies consecutive SSH login failures targeting a user account from the same source IP address to the same target host indicating brute force login attempts.
This rule will generate a lot of noise for systems with a front-facing SSH service, as adversaries scan the internet for remotely accessible SSH services and try to brute force them to gain unauthorized access.
In case this rule generates too much noise and external brute forcing is of not much interest, consider turning this rule off and enabling "Potential Internal Linux SSH Brute Force Detected" to detect internal brute force attempts.
Possible investigation steps
- Investigate the login failure user name(s).
- Investigate the source IP address of the failed ssh login attempt(s).
- Investigate other alerts associated with the user/host during the past 48 hours.
- Identify the source and the target computer and their roles in the IT environment.
False positive analysis
- Authentication misconfiguration or obsolete credentials.
- Service account password expired.
- Infrastructure or availability issue.
Related Rules
- Potential Internal Linux SSH Brute Force Detected - 1c27fa22-7727-4dd3-81c0-de6da5555feb
- Potential SSH Password Guessing - 8cb84371-d053-4f4f-bce0-c74990e28f28
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved hosts to prevent further post-compromise behavior.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
Related rules
- Linux Process Hooking via GDB
- Linux init (PID 1) Secret Dump via GDB
- Modification of Standard Authentication Module or Configuration
- Potential Internal Linux SSH Brute Force Detected
- Potential Linux Credential Dumping via Proc Filesystem