Potential Password Spraying Attack via SSH

Last updated 19 days ago on 2025-12-24
Created 19 days ago on 2025-12-24

About

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.
Tags
Domain: EndpointOS: LinuxUse Case: Threat DetectionTactic: Credential AccessLanguage: esql
Severity
low
Risk Score
21
MITRE ATT&CK™

Credential Access (TA0006)(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

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

Query
text code block:
from logs-system.auth-* metadata _id, _index, _version // Create 5-minute time buckets | eval Esql.time_window_date_trunc = date_trunc(5 minutes, @timestamp) // Ensure event.action values in a list are expanded | mv_expand event.action | where event.category == "authentication" and event.action in ("ssh_login", "user_login") and event.outcome == "failure" and source.ip is not null // Keep relevant fields | 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, Esql.time_window_date_trunc | stats Esql.event_count = count(*), Esql.user_name_count_distinct = count_distinct(user.name), Esql.user_name_values = values(user.name), Esql.process_name_values = values(process.name), Esql.event_dataset_values = values(event.dataset), Esql.data_stream_namespace_values = values(data_stream.namespace) by Esql.time_window_date_trunc, source.ip | where Esql.user_name_count_distinct > 10 and Esql.event_count >= 30

Install detection rules in Elastic Security

Detect Potential Password Spraying Attack via SSH 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).