Privilege Escalation (TA0004)(external, opens in a new tab or window)
Credential Access (TA0006)(external, opens in a new tab or window)
text code block: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
Install detection rules in Elastic Security
Detect Excessive Sudo Authentication Failures via macOS Security Events in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).