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"
5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
6min_stack_version = "8.3.0"
7updated_date = "2023/09/05"
8
9[rule]
10author = ["Elastic"]
11description = """
12Identifies multiple SSH login failures followed by a successful one from the same source address. Adversaries can attempt
13to login into multiple users with a common or known password to gain access to accounts.
14"""
15from = "now-9m"
16index = ["auditbeat-*", "logs-system.auth-*"]
17language = "eql"
18license = "Elastic License v2"
19name = "Potential Successful SSH Brute Force Attack"
20note = """## Triage and analysis
21
22### Investigating Potential Successful SSH Brute Force Attack
23
24The 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.
25
26#### Possible investigation steps
27
28- Investigate the login failure user name(s).
29- Investigate the source IP address of the failed ssh login attempt(s).
30- Investigate other alerts associated with the user/host during the past 48 hours.
31- Identify the source and the target computer and their roles in the IT environment.
32
33### False positive analysis
34
35- Authentication misconfiguration or obsolete credentials.
36- Service account password expired.
37- Infrastructure or availability issue.
38
39### Response and remediation
40
41- Initiate the incident response process based on the outcome of the triage.
42- Ensure active session(s) on the host(s) are terminated as the attacker could have gained initial access to the system(s).
43- Isolate the involved hosts to prevent further post-compromise behavior.
44- 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.
45- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
46- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
47- 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).
48
49"""
50risk_score = 73
51rule_id = "8cb84371-d053-4f4f-bce0-c74990e28f28"
52severity = "high"
53tags = ["Domain: Endpoint", "OS: Linux", "Use Case: Threat Detection", "Tactic: Credential Access"]
54type = "eql"
55query = '''
56sequence by host.id, source.ip, user.name with maxspan=3s
57 [authentication where host.os.type == "linux" and event.action in ("ssh_login", "user_login") and
58 event.outcome == "failure" and source.ip != null and source.ip != "0.0.0.0" and source.ip != "::" ] with runs=10
59
60 [authentication where host.os.type == "linux" and event.action in ("ssh_login", "user_login") and
61 event.outcome == "success" and source.ip != null and source.ip != "0.0.0.0" and source.ip != "::" ]
62'''
63
64[[rule.threat]]
65framework = "MITRE ATT&CK"
66
67[[rule.threat.technique]]
68id = "T1110"
69name = "Brute Force"
70reference = "https://attack.mitre.org/techniques/T1110/"
71
72[[rule.threat.technique.subtechnique]]
73id = "T1110.001"
74name = "Password Guessing"
75reference = "https://attack.mitre.org/techniques/T1110/001/"
76
77[[rule.threat.technique.subtechnique]]
78id = "T1110.003"
79name = "Password Spraying"
80reference = "https://attack.mitre.org/techniques/T1110/003/"
81
82[rule.threat.tactic]
83id = "TA0006"
84name = "Credential Access"
85reference = "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 init (PID 1) Secret Dump via GDB
- Unusual Linux Process Calling the Metadata Service
- Unusual Linux User Calling the Metadata Service
- Potential External Linux SSH Brute Force Detected
- Potential Internal Linux SSH Brute Force Detected