Elastic low stable kql
Excessive Sudo Authentication Failures via macOS Security Events
Identifies a high number of failed sudo password attempts on a macOS host within a short time window, using sudo messages collected by the Authentication data stream of the macOS Security Events integration. Repeated sudo authentication failures may indicate an adversary with access to a low-privileged account attempting to guess an administrator password to escalate privileges.
Detection Logic
FROM logs-macos.authentication-*
| WHERE data_stream.dataset == "macos.authentication" and
macos.process.image_path LIKE "*/sudo" and
macos.event.message.description LIKE "*incorrect password attempt*"
| GROK macos.event.message.description "%{NOTSPACE:user_name} : %{NUMBER:attempt_count:int} incorrect password attempt%{DATA} ; TTY=%{NOTSPACE:tty} ; PWD=%{DATA:pwd} ; USER=%{NOTSPACE:target_user} ; COMMAND=%{GREEDYDATA:command}"
| STATS
Esql.failure_event_count = COUNT(*),
Esql.attempt_total = SUM(attempt_count),
Esql.user_name_values = VALUES(user_name),
Esql.target_user_values = VALUES(target_user),
Esql.tty_values = VALUES(tty),
Esql.command_values = VALUES(command)
BY host.id, host.name
| WHERE Esql.attempt_total >= 10
| KEEP host.id, host.name, Esql.failure_event_count, Esql.attempt_total, Esql.user_name_values, Esql.target_user_values, Esql.tty_values, Esql.command_values Field Validations
Loading…
Comments (0)
Loading comments...