Potential Successful SSH Brute Force Attack
Identifies multiple SSH login failures followed by a successful one from the same source address. Adversaries can attempt to login into multiple users with a common or known password to gain access to 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 SSH login failures followed by a successful one from the same source address. Adversaries can
11attempt to login into multiple users with a common or known password to gain access to accounts.
12"""
13from = "now-9m"
14index = ["auditbeat-*", "filebeat-*", "logs-system.auth-*"]
15language = "eql"
16license = "Elastic License v2"
17name = "Potential Successful SSH Brute Force Attack"
18note = """## Triage and analysis
19
20### Investigating Potential Successful SSH Brute Force Attack
21
22The rule identifies consecutive SSH login failures followed by a successful login from the same source IP address to the same target host indicating a successful attempt of brute force password guessing.
23
24#### Possible investigation steps
25
26- Investigate the login failure user name(s).
27- Investigate the source IP address of the failed ssh login attempt(s).
28- Investigate other alerts associated with the user/host during the past 48 hours.
29- Identify the source and the target computer and their roles in the IT environment.
30
31### False positive analysis
32
33- Authentication misconfiguration or obsolete credentials.
34- Service account password expired.
35- Infrastructure or availability issue.
36
37### Response and remediation
38
39- Initiate the incident response process based on the outcome of the triage.
40- Ensure active session(s) on the host(s) are terminated as the attacker could have gained initial access to the system(s).
41- Isolate the involved hosts to prevent further post-compromise behavior.
42- 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.
43- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
44- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
45- 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).
46"""
47risk_score = 73
48rule_id = "8cb84371-d053-4f4f-bce0-c74990e28f28"
49setup = """## Setup
50
51This rule requires data coming in from one of the following integrations:
52- Auditbeat
53- Filebeat
54
55### Auditbeat Setup
56Auditbeat is a lightweight shipper that you can install on your servers to audit the activities of users and processes on your systems. For example, you can use Auditbeat to collect and centralize audit events from the Linux Audit Framework. You can also use Auditbeat to detect changes to critical files, like binaries and configuration files, and identify potential security policy violations.
57
58#### The following steps should be executed in order to add the Auditbeat on a Linux System:
59- Elastic provides repositories available for APT and YUM-based distributions. Note that we provide binary packages, but no source packages.
60- To install the APT and YUM repositories follow the setup instructions in this [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/setup-repositories.html).
61- To run Auditbeat on Docker follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/running-on-docker.html).
62- To run Auditbeat on Kubernetes follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/running-on-kubernetes.html).
63- For complete “Setup and Run Auditbeat” information refer to the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/setting-up-and-running.html).
64
65### Filebeat Setup
66Filebeat 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.
67
68#### The following steps should be executed in order to add the Filebeat on a Linux System:
69- Elastic provides repositories available for APT and YUM-based distributions. Note that we provide binary packages, but no source packages.
70- 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).
71- 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).
72- 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).
73- 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).
74- 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).
75
76#### Rule Specific Setup Note
77- This rule requires the “Filebeat System Module” to be enabled.
78- The system module collects and parses logs created by the system logging service of common Unix/Linux based distributions.
79- 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).
80"""
81severity = "high"
82tags = ["Domain: Endpoint", "OS: Linux", "Use Case: Threat Detection", "Tactic: Credential Access"]
83type = "eql"
84
85query = '''
86sequence by host.id, source.ip, user.name with maxspan=15s
87 [authentication where host.os.type == "linux" and event.action in ("ssh_login", "user_login") and
88 event.outcome == "failure" and source.ip != null and source.ip != "0.0.0.0" and source.ip != "::" ] with runs=10
89
90 [authentication where host.os.type == "linux" and event.action in ("ssh_login", "user_login") and
91 event.outcome == "success" and source.ip != null and source.ip != "0.0.0.0" and source.ip != "::" ]
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 Successful SSH Brute Force Attack
The rule identifies consecutive SSH login failures followed by a successful login from the same source IP address to the same target host indicating a successful attempt of brute force password guessing.
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.
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Ensure active session(s) on the host(s) are terminated as the attacker could have gained initial access to the system(s).
- 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 External Linux SSH Brute Force Detected
- Potential Internal Linux SSH Brute Force Detected