-
Notifications
You must be signed in to change notification settings - Fork 622
[New Rule] Potential Password Spraying Attack via SSH #5515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Rule: New - GuidelinesThese guidelines serve as a reminder set of considerations when proposing a new rule. Documentation and Context
Rule Metadata Checks
New BBR Rules
Testing and Validation
|
|
⛔️ Test failed Results
|
| timestamp_override = "event.ingested" | ||
| type = "esql" | ||
| query = ''' | ||
| from "logs-system.auth-*" metadata _id, _index, _version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| from "logs-system.auth-*" metadata _id, _index, _version | |
| from logs-system.auth-* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed this on Slack, although not necessary (as metadata is dropped after stats), we are enforcing metadata in unit tests soon for non-stats queries, and I think it's better for consistency to just add it, as it does no harm (as far as I know), and makes all rules similar.
| | keep | ||
| @timestamp, | ||
| _id, | ||
| _index, | ||
| _version, | ||
| event.category, | ||
| event.action, | ||
| event.outcome, | ||
| source.ip, | ||
| process.name, | ||
| user.name, | ||
| event.dataset, | ||
| data_stream.namespace, | ||
| agent.id, | ||
| user.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| | keep | |
| @timestamp, | |
| _id, | |
| _index, | |
| _version, | |
| event.category, | |
| event.action, | |
| event.outcome, | |
| source.ip, | |
| process.name, | |
| user.name, | |
| event.dataset, | |
| data_stream.namespace, | |
| agent.id, | |
| user.id |
Everything that is not used in the stats is dropped, makes more sense to do the KEEP after stats
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding KEEP after stats also makes no sense, because stats will only keep all fields within the by clause or used in the stats function, so it would not really do much. I mostly add keeps because the unit tests expect them. Think it is good to have a broader discussion about this in the new year.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are pros and cons for enforcing KEEP and placement. Performance (if any) for aggregation-based (use it before aggregating for performance). Otherwise by does a KEEP in theory. Non-aggregation-based, it can be used but forces limitations on fields that appear in the alert doc which I don't believe we want to practice doing. Maybe we follow-up with ES on the subject and if it is still best practice given our scenarios and rule examples.
rules/linux/credential_access_potential_password_spraying_attack.toml
Outdated
Show resolved
Hide resolved
|
|
||
| by source.ip | ||
|
|
||
| | where Esql.user_name_count_distinct > 10 and Esql.event_count >= 30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| | where Esql.user_name_count_distinct > 10 and Esql.event_count >= 30 | |
| | where Esql.user_name_count_distinct > 10 and Esql.event_count >= 30 | |
| | keep Esql.*, source.ip |
rules/linux/credential_access_potential_password_spraying_attack.toml
Outdated
Show resolved
Hide resolved
…ck.toml Co-authored-by: Jonhnathan <26856693+w0rk3r@users.noreply.github.com>
|
⛔️ Test failed Results
|
|
⛔️ Test failed Results
|
Mikaayenson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question that comes to mind is the bustiness of this. I think it's >10 unique users and >=30 failures in 1 min bucket? I wonder if we should expand the bucket e.g. 5 min or lower the counts?
|
⛔️ Test failed Results
|
|
⛔️ Test failed Results
|
|
⛔️ Test failed Results
|
|
@Mikaayenson expanded the interval slightly. |
Summary
This rule detects potential password spraying attacks via SSH by identifying multiple failed login attempts from a single source IP address targeting various user accounts within a short time frame. Password spraying is a technique where an attacker attempts to gain unauthorized access by trying a few commonly used passwords against many different accounts, rather than targeting a single account with multiple password attempts.