Detection of SSH Brute Force Attacks on macOS
Adversaries are targeting macOS hosts via SSH brute force or password spraying, which can be identified by analyzing failed authentication logs generated by the sshd-session process.
Adversaries targeting macOS systems frequently attempt to gain unauthorized access by conducting brute force or password spraying attacks against exposed SSH services. These campaigns rely on automated tools to test common username and password combinations against the macOS sshd-session process. When authentication fails, the macOS unified log records specific error messages, including "Failed password", "Failed keyboard-interactive/pam", and "Connection closed by invalid user". Because macOS enables Remote Login in certain administrative or development environments, these hosts become attractive targets for opportunistic credential harvesting. Detection engineers can identify this activity by monitoring the macOS Security Events integration for a high frequency of authentication failure messages originating from external or suspicious IP addresses within a condensed timeframe.
Impact
Successful brute force attacks can lead to full system compromise, unauthorized data access, and the installation of persistence mechanisms. Attackers often target developer workstations or build servers that may have elevated permissions or access to sensitive source code and credentials. If an adversary successfully authenticates, they may move laterally within the network or use the host as a staging point for further malicious activity.
Recommendation
Prioritize the identification and hardening of internet-facing macOS hosts with Remote Login enabled.
- Implement the detection logic described below to alert on high volumes of failed SSH authentication attempts.
- Review successful authentication events immediately following a series of failures to identify successful unauthorized access.
- Disable Remote Login on macOS hosts where SSH access is not required for daily operations.
- Enforce SSH key-based authentication and restrict access using the
AllowUsersorAllowGroupsdirectives in the SSH configuration. - Block or rate-limit source IP addresses identified as performing high-volume authentication attempts.
Immediate actions
Deploy the provided detection rule and tune against known automation traffic.
Threat Hunt
Search for 'Accepted' SSH messages following a series of failures on the same host.
Data: macOS authentication logs
Mitigations
Disable Remote Login (SSH) on non-essential macOS hosts.
T1133
Detection coverage 1
Detect SSH Authentication Failures on macOS
lowDetects multiple failed SSH authentication attempts on a macOS host within a short window, indicative of brute force or password spraying.
Detection queries are available on the platform. Get full rules →