[Rule Tuning & Addition] Potential Linux SSH Brute Force (#2583)

* [Rule tuning & Addition] SSH Bruteforce

* Update rules/linux/credential_access_potential_linux_ssh_bruteforce_internal.toml

Co-authored-by: Justin Ibarra <16747370+brokensound77@users.noreply.github.com>

* Update rules/linux/credential_access_potential_linux_ssh_bruteforce_external.toml

Co-authored-by: Justin Ibarra <16747370+brokensound77@users.noreply.github.com>

* Update rules/linux/credential_access_potential_linux_ssh_bruteforce_external.toml

Co-authored-by: Justin Ibarra <16747370+brokensound77@users.noreply.github.com>

* Update rules/linux/credential_access_potential_linux_ssh_bruteforce_external.toml

Co-authored-by: Jonhnathan <26856693+w0rk3r@users.noreply.github.com>

* Update rules/linux/credential_access_potential_linux_ssh_bruteforce_internal.toml

Co-authored-by: Jonhnathan <26856693+w0rk3r@users.noreply.github.com>

* fixed rule_id change, added additional cidr match

* added host.os.type==linux

* Update credential_access_potential_linux_ssh_bruteforce_internal.toml

* Formatting style change

* Update rules/linux/credential_access_potential_linux_ssh_bruteforce_external.toml

Co-authored-by: Jonhnathan <26856693+w0rk3r@users.noreply.github.com>

* Update rules/linux/credential_access_potential_linux_ssh_bruteforce_external.toml

Co-authored-by: Jonhnathan <26856693+w0rk3r@users.noreply.github.com>

* Added related rules suggestion

* Added related rule suggestion

* added additional internal ip ranges

* added additional internal ip ranges

---------

Co-authored-by: Justin Ibarra <16747370+brokensound77@users.noreply.github.com>
Co-authored-by: Colson Wilhoit <48036388+DefSecSentinel@users.noreply.github.com>
Co-authored-by: Jonhnathan <26856693+w0rk3r@users.noreply.github.com>
This commit is contained in:
Ruben Groenewoud
2023-05-25 12:00:44 +02:00
committed by GitHub
parent 8766734c89
commit 54c5c17aa3
2 changed files with 120 additions and 12 deletions
@@ -0,0 +1,98 @@
[metadata]
creation_date = "2022/09/14"
integration = ["system"]
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2023/03/21"
[rule]
author = ["Elastic"]
description = """
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.
"""
from = "now-9m"
index = ["logs-system.auth-*"]
language = "eql"
license = "Elastic License v2"
name = "Potential External Linux SSH Brute Force Detected"
note = """## 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).
"""
risk_score = 21
rule_id = "fa210b61-b627-4e5e-86f4-17e8270656ab"
severity = "low"
tags = ["Elastic", "Host", "Linux", "Threat Detection", "Credential Access"]
type = "eql"
query = '''
sequence by host.id, source.ip, user.name with maxspan=5s
[ authentication where host.os.type == "linux" and
event.action in ("ssh_login", "user_login") and event.outcome == "failure" and
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",
"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",
"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",
"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",
"::1", "FE80::/10", "FF00::/8") ] with runs = 3
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1110"
name = "Brute Force"
reference = "https://attack.mitre.org/techniques/T1110/"
[[rule.threat.technique.subtechnique]]
id = "T1110.001"
name = "Password Guessing"
reference = "https://attack.mitre.org/techniques/T1110/001/"
[[rule.threat.technique.subtechnique]]
id = "T1110.003"
name = "Password Spraying"
reference = "https://attack.mitre.org/techniques/T1110/003/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
@@ -1,28 +1,28 @@
[metadata]
creation_date = "2022/09/14"
creation_date = "2023/02/21"
integration = ["system"]
maturity = "production"
min_stack_comments = "New fields added: required_fields, related_integrations, setup"
min_stack_version = "8.3.0"
updated_date = "2023/02/22"
updated_date = "2023/03/21"
[rule]
author = ["Elastic"]
description = """
Identifies multiple consecutive login failures targeting an user account from the same source address and 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 accounts.
Identifies multiple internal 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.
"""
from = "now-9m"
index = ["auditbeat-*", "logs-system.auth-*"]
index = ["logs-system.auth-*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Linux SSH Brute Force Detected"
name = "Potential Internal Linux SSH Brute Force Detected"
note = """## Triage and analysis
### Investigating Potential SSH Brute Force Attack
### Investigating Potential Internal 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.
The rule identifies consecutive internal SSH login failures targeting a user account from the same source IP address to the same target host indicating brute force login attempts.
#### Possible investigation steps
@@ -37,6 +37,11 @@ The rule identifies consecutive SSH login failures targeting a user account from
- Service account password expired.
- Infrastructure or availability issue.
### Related Rules
- Potential External Linux SSH Brute Force Detected - fa210b61-b627-4e5e-86f4-17e8270656ab
- Potential SSH Password Guessing - 8cb84371-d053-4f4f-bce0-c74990e28f28
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
@@ -53,9 +58,14 @@ severity = "medium"
tags = ["Elastic", "Host", "Linux", "Threat Detection", "Credential Access"]
type = "eql"
query = '''
sequence by host.id, source.ip, user.name with maxspan=10s
[authentication where host.os.type == "linux" and event.action in ("ssh_login", "user_login") and
event.outcome == "failure" and source.ip != null and source.ip != "0.0.0.0" and source.ip != "::" ] with runs=10
sequence by host.id, source.ip, user.name with maxspan=5s
[ authentication where host.os.type == "linux" and
event.action in ("ssh_login", "user_login") and event.outcome == "failure" and
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",
"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",
"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",
"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",
"::1", "FE80::/10", "FF00::/8") ] with runs = 3
'''