Potential SSH Brute Force Detected via macOS Security Events

Last updated 7 days ago on 2026-09-09
Created 7 days ago on 2026-09-09

About

Identifies a high number of failed inbound SSH authentication attempts on a macOS host within a short time window, using sshd authentication messages collected by the macOS Security Events integration. Adversaries may perform password brute force or password spraying against exposed SSH services to obtain unauthorized access.
Tags
OS: macOSUse Case: Threat DetectionTactic: Credential AccessData Source: macOS Security EventsLanguage: esql
Severity
low
Risk Score
21
MITRE ATT&CK™

Credential Access (TA0006)(external, opens in a new tab or window)

Initial Access (TA0001)(external, opens in a new tab or window)

License
Elastic License v2(external, opens in a new tab or window)

Definition

Integration Pack
Prebuilt Security Detection Rules
Related Integrations

macos(external, opens in a new tab or window)

Query
text code block:
FROM logs-macos.authentication-* | WHERE data_stream.dataset == "macos.authentication" and ( macos.event.message.description LIKE "Failed password for*" or macos.event.message.description LIKE "Failed keyboard-interactive/pam for*" or macos.event.message.description LIKE "error: PAM: authentication error for*" or macos.event.message.description LIKE "Connection closed by invalid user*" ) | GROK macos.event.message.description "for (invalid user )?%{NOTSPACE:Esql.user_name_attempt} from %{IP:Esql.source_ip_attempt}" | GROK macos.event.message.description "closed by invalid user %{NOTSPACE:Esql.user_name_probe} %{IP:Esql.source_ip_probe}" | EVAL Esql.user_name = COALESCE(Esql.user_name_attempt, Esql.user_name_probe), Esql.source_ip = COALESCE(Esql.source_ip_attempt, Esql.source_ip_probe) | STATS Esql.event_count = COUNT(*), Esql.user_name_values = VALUES(Esql.user_name), Esql.user_name_count = COUNT_DISTINCT(Esql.user_name), Esql.source_ip_values = VALUES(Esql.source_ip), Esql.source_ip_count = COUNT_DISTINCT(Esql.source_ip) BY host.id, host.name | WHERE Esql.event_count >= 20 | KEEP host.id, host.name, Esql.event_count, Esql.user_name_values, Esql.user_name_count, Esql.source_ip_values, Esql.source_ip_count

Install detection rules in Elastic Security

Detect Potential SSH Brute Force Detected 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).