Detection rules › Elastic

Privileged Accounts Brute Force

Status
production
Severity
medium
Time window
9m
Group by
Esql.time_window, source.ip, winlog.computer_name, winlog.logon.type
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies multiple consecutive logon failures targeting more than one Admin account from the same source address and within a short time interval. Adversaries will often brute force login attempts across multiple users with a common or known password, in an attempt to gain access to accounts.

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
Security-AuditingEvent ID 4625An account failed to log on.

Rule body elastic

[metadata]
creation_date = "2020/08/29"
integration = ["system", "windows"]
maturity = "production"
updated_date = "2026/05/04"

[transform]
[[transform.osquery]]
label = "Osquery - Retrieve DNS Cache"
query = "SELECT * FROM dns_cache"

[[transform.osquery]]
label = "Osquery - Retrieve All Services"
query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"

[[transform.osquery]]
label = "Osquery - Retrieve Services Running on User Accounts"
query = """
SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
user_account == null)
"""

[[transform.osquery]]
label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
query = """
SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
"""


[rule]
author = ["Elastic"]
description = """
Identifies multiple consecutive logon failures targeting more than one Admin account from the same source address and within a
short time interval. Adversaries will often brute force login attempts across multiple users with a common or known
password, in an attempt to gain access to accounts.
"""
from = "now-9m"
language = "esql"
license = "Elastic License v2"
name = "Privileged Accounts Brute Force"
note = """## Triage and analysis

### Investigating Privileged Accounts Brute Force

Adversaries with no prior knowledge of legitimate credentials within the system or environment may guess passwords to attempt access to accounts. Without knowledge of the password for an account, an adversary may opt to guess the password using a repetitive or iterative mechanism systematically. More details can be found [here](https://attack.mitre.org/techniques/T1110/001/).

This rule identifies potential password guessing/brute force activity from a single address against multiple accounts that contains the `admin` pattern on its name, which is likely a highly privileged account.

> **Note**:
> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/current/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.

#### Possible investigation steps

- Investigate the logon failure reason code and the targeted user name.
  - Prioritize the investigation if the account is critical or has administrative privileges over the domain.
- Investigate the source IP address of the failed Network Logon attempts.
  - Identify whether these attempts are coming from the internet or are internal.
- Investigate other alerts associated with the involved users and source host during the past 48 hours.
- Identify the source and the target computer and their roles in the IT environment.
- Check whether the involved credentials are used in automation or scheduled tasks.
- If this activity is suspicious, contact the account owner and confirm whether they are aware of it.
- Examine the source host for derived artifacts that indicate compromise:
  - Observe and collect information about the following activities in the alert source host:
    - Attempts to contact external domains and addresses.
      - Examine the DNS cache for suspicious or anomalous entries.
        - $osquery_0
    - Examine the host services for suspicious or anomalous entries.
      - $osquery_1
      - $osquery_2
      - $osquery_3
- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the host which is the source of this activity.

### False positive analysis

- Authentication misconfiguration or obsolete credentials.
- Service account password expired.
- Domain trust relationship issues.
- Infrastructure or availability issues.

### Response and remediation

- Initiate the incident response process based on the outcome of the triage.
- Isolate the source host to prevent further post-compromise behavior.
- If the asset is exposed to the internet with RDP or other remote services available, take the necessary measures to restrict access to the asset. If not possible, limit the access via the firewall to only the needed IP addresses. Also, ensure the system uses robust authentication mechanisms and is patched regularly.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""

setup = """## Setup

Audit Logon must be enabled to generate the events used by this rule.
Setup instructions: https://ela.st/audit-logon
"""

references = ["https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4625"]
risk_score = 47
rule_id = "f9790abf-bd0c-45f9-8b5f-d0b74015e029"
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Credential Access",
    "Resources: Investigation Guide",
    "Data Source: Windows Security Event Logs",
]
type = "esql"

query = '''
from logs-system.security*, logs-windows.forwarded*, winlogbeat-* metadata _id, _version, _index
| where event.category == "authentication" and host.os.type == "windows" and event.action == "logon-failed" and
  winlog.logon.type == "Network" and source.ip is not null and winlog.computer_name is not null and
  not cidr_match(TO_IP(source.ip), "127.0.0.0/8", "::1") and
  to_lower(winlog.event_data.TargetUserName) like "*admin*"  and
  /*
    noisy failure status codes often associated to authentication misconfiguration
     0xC000015B - The user has not been granted the requested logon type (also called the logon right) at this machine.
     0XC000005E - There are currently no logon servers available to service the logon request.
     0XC0000133 - Clocks between DC and other computer too far out of sync.
     0XC0000192 An attempt was made to logon, but the Netlogon service was not started.
     0xc00000dc - DC is in shutdown phase, it will normally tell current clients to use another DC for authentication.
  */
  not winlog.event_data.Status in ("0xc000015b", "0xc000005e", "0xc0000133", "0xc0000192", "0xc00000dc")
// truncate the timestamp to a 60-second window
| eval Esql.time_window = date_trunc(60 seconds, @timestamp)
| stats Esql.failed_auth_count = COUNT(*),
        Esql.target_user_name_values = VALUES(winlog.event_data.TargetUserName),
        Esql.count_distinct_user_name = count_distinct(winlog.event_data.TargetUserName),
        Esql.user_domain_values = VALUES(user.domain),
        Esql.error_codes = VALUES(winlog.event_data.Status),
        Esql.data_stream_namespace.values = VALUES(data_stream.namespace) by winlog.computer_name, source.ip, Esql.time_window, winlog.logon.type
| where Esql.failed_auth_count >= 50 and Esql.count_distinct_user_name >= 2
| eval user.name = mv_first(Esql.target_user_name_values)
| KEEP winlog.computer_name, source.ip, user.name, Esql.time_window, winlog.logon.type, Esql.*
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1110"
name = "Brute Force"
reference = "https://attack.mitre.org/techniques/T1110/"
[[rule.threat.technique.subtechnique]]
id = "T1110.001"
name = "Password Guessing"
reference = "https://attack.mitre.org/techniques/T1110/001/"

[[rule.threat.technique.subtechnique]]
id = "T1110.003"
name = "Password Spraying"
reference = "https://attack.mitre.org/techniques/T1110/003/"



[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"

Stages and Predicates

Stage 1: from

from logs-system.security*, logs-windows.forwarded*, winlogbeat-* metadata _id, _version, _index

Stage 2: where

| where event.category == "authentication" and host.os.type == "windows" and event.action == "logon-failed" and
  winlog.logon.type == "Network" and source.ip is not null and winlog.computer_name is not null and
  not cidr_match(TO_IP(source.ip), "127.0.0.0/8", "::1") and
  to_lower(winlog.event_data.TargetUserName) like "*admin*"  and
  /*
    noisy failure status codes often associated to authentication misconfiguration
     0xC000015B - The user has not been granted the requested logon type (also called the logon right) at this machine.
     0XC000005E - There are currently no logon servers available to service the logon request.
     0XC0000133 - Clocks between DC and other computer too far out of sync.
     0XC0000192 An attempt was made to logon, but the Netlogon service was not started.
     0xc00000dc - DC is in shutdown phase, it will normally tell current clients to use another DC for authentication.
  */
  not winlog.event_data.Status in ("0xc000015b", "0xc000005e", "0xc0000133", "0xc0000192", "0xc00000dc")

Stage 3: eval

| eval Esql.time_window = date_trunc(60 seconds, @timestamp)

Stage 4: stats

| stats Esql.failed_auth_count = COUNT(*),
        Esql.target_user_name_values = VALUES(winlog.event_data.TargetUserName),
        Esql.count_distinct_user_name = count_distinct(winlog.event_data.TargetUserName),
        Esql.user_domain_values = VALUES(user.domain),
        Esql.error_codes = VALUES(winlog.event_data.Status),
        Esql.data_stream_namespace.values = VALUES(data_stream.namespace) by winlog.computer_name, source.ip, Esql.time_window, winlog.logon.type

Stage 5: where

| where Esql.failed_auth_count >= 50 and Esql.count_distinct_user_name >= 2

Stage 6: eval

| eval user.name = mv_first(Esql.target_user_name_values)

Stage 7: keep

| KEEP winlog.computer_name, source.ip, user.name, Esql.time_window, winlog.logon.type, Esql.*

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
TO_IP(source.ip)cidr_match127.0.0.0/8, ::1
winlog.event_data.Statusin0xc000005e, 0xc00000dc, 0xc0000133, 0xc000015b, 0xc0000192

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
Esql.count_distinct_user_namege
  • 2
Esql.failed_auth_countge
  • 50
event.actioneq
  • logon-failed corpus 3 (elastic 3)
event.categoryeq
  • authentication corpus 31 (elastic 31)
source.ipis_not_null
  • (no value, null check)
winlog.computer_nameis_not_null
  • (no value, null check)
winlog.logon.typeeq
  • Network corpus 40 (splunk 13, sigma 12, elastic 9, kusto 6)

Output fields

Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.

FieldSource
winlog.computer_nameKEEP winlog.computer_name
source.ipKEEP source.ip
user.nameKEEP user.name
Esql.time_windowKEEP Esql.time_window
winlog.logon.typeKEEP winlog.logon.type
Esql.*KEEP Esql.*