Multiple Logon Failure Followed by Logon Success

Identifies multiple logon failures followed by a successful one from the same source address. Adversaries will often brute force login attempts across multiple users with a common or known password, in an attempt to gain access to accounts.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2020/08/29"
  3integration = ["system", "windows"]
  4maturity = "production"
  5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
  6min_stack_version = "8.3.0"
  7updated_date = "2024/03/08"
  8
  9[transform]
 10[[transform.osquery]]
 11label = "Osquery - Retrieve DNS Cache"
 12query = "SELECT * FROM dns_cache"
 13
 14[[transform.osquery]]
 15label = "Osquery - Retrieve All Services"
 16query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
 17
 18[[transform.osquery]]
 19label = "Osquery - Retrieve Services Running on User Accounts"
 20query = """
 21SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
 22NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
 23user_account == null)
 24"""
 25
 26[[transform.osquery]]
 27label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
 28query = """
 29SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
 30services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
 31authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
 32"""
 33
 34
 35[rule]
 36author = ["Elastic"]
 37description = """
 38Identifies multiple logon failures followed by a successful one from the same source address. Adversaries will often
 39brute force login attempts across multiple users with a common or known password, in an attempt to gain access to
 40accounts.
 41"""
 42from = "now-9m"
 43index = ["winlogbeat-*", "logs-system.security*", "logs-windows.forwarded*"]
 44language = "eql"
 45license = "Elastic License v2"
 46name = "Multiple Logon Failure Followed by Logon Success"
 47note = """## Triage and analysis
 48
 49### Investigating Multiple Logon Failure Followed by Logon Success
 50
 51Adversaries 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/).
 52
 53This rule identifies potential password guessing/brute force activity from a single address, followed by a successful logon, indicating that an attacker potentially successfully compromised the account.
 54
 55> **Note**:
 56> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/master/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
 57
 58#### Possible investigation steps
 59
 60- Investigate the logon failure reason code and the targeted user name.
 61  - Prioritize the investigation if the account is critical or has administrative privileges over the domain.
 62- Investigate the source IP address of the failed Network Logon attempts.
 63  - Identify whether these attempts are coming from the internet or are internal.
 64- Investigate other alerts associated with the involved users and source host during the past 48 hours.
 65- Identify the source and the target computer and their roles in the IT environment.
 66- Check whether the involved credentials are used in automation or scheduled tasks.
 67- If this activity is suspicious, contact the account owner and confirm whether they are aware of it.
 68- Examine the source host for derived artifacts that indicate compromise:
 69  - Observe and collect information about the following activities in the alert source host:
 70    - Attempts to contact external domains and addresses.
 71      - Examine the DNS cache for suspicious or anomalous entries.
 72        - $osquery_0
 73    - Examine the host services for suspicious or anomalous entries.
 74      - $osquery_1
 75      - $osquery_2
 76      - $osquery_3
 77- 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.
 78
 79### False positive analysis
 80
 81- Authentication misconfiguration or obsolete credentials.
 82- Service account password expired.
 83- Domain trust relationship issues.
 84- Infrastructure or availability issues.
 85
 86### Related rules
 87
 88- Multiple Logon Failure from the same Source Address - 48b6edfc-079d-4907-b43c-baffa243270d
 89
 90### Response and remediation
 91
 92- Initiate the incident response process based on the outcome of the triage.
 93- Isolate the source host to prevent further post-compromise behavior.
 94- 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.
 95- 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.
 96- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 97- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 98- 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).
 99"""
100references = ["https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4625"]
101risk_score = 47
102rule_id = "4e85dc8a-3e41-40d8-bc28-91af7ac6cf60"
103setup = """## Setup
104
105If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
106events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
107Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
108`event.ingested` to @timestamp.
109For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
110"""
111severity = "medium"
112tags = ["Domain: Endpoint", "OS: Windows", "Use Case: Threat Detection", "Tactic: Credential Access", "Resources: Investigation Guide"]
113type = "eql"
114
115query = '''
116sequence by winlog.computer_name, source.ip with maxspan=5s
117  [authentication where event.action == "logon-failed" and
118    /* event 4625 need to be logged */
119    winlog.logon.type : "Network" and user.id != null and 
120    source.ip != null and source.ip != "127.0.0.1" and source.ip != "::1" and 
121    not winlog.event_data.TargetUserSid : "S-1-0-0" and not user.id : "S-1-0-0" and 
122    not user.name : ("ANONYMOUS LOGON", "-", "*$") and not user.domain == "NT AUTHORITY" and
123
124    /* noisy failure status codes often associated to authentication misconfiguration */
125    not winlog.event_data.Status : ("0xC000015B", "0XC000005E", "0XC0000133", "0XC0000192")] with runs=5
126  [authentication where event.action == "logged-in" and
127    /* event 4624 need to be logged */
128    winlog.logon.type : "Network" and
129    source.ip != null and source.ip != "127.0.0.1" and source.ip != "::1" and
130    not user.name : ("ANONYMOUS LOGON", "-", "*$") and not user.domain == "NT AUTHORITY"]
131'''
132
133
134[[rule.threat]]
135framework = "MITRE ATT&CK"
136[[rule.threat.technique]]
137id = "T1110"
138name = "Brute Force"
139reference = "https://attack.mitre.org/techniques/T1110/"
140[[rule.threat.technique.subtechnique]]
141id = "T1110.001"
142name = "Password Guessing"
143reference = "https://attack.mitre.org/techniques/T1110/001/"
144
145[[rule.threat.technique.subtechnique]]
146id = "T1110.003"
147name = "Password Spraying"
148reference = "https://attack.mitre.org/techniques/T1110/003/"
149
150
151
152[rule.threat.tactic]
153id = "TA0006"
154name = "Credential Access"
155reference = "https://attack.mitre.org/tactics/TA0006/"

Triage and analysis

Investigating Multiple Logon Failure Followed by Logon Success

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.

This rule identifies potential password guessing/brute force activity from a single address, followed by a successful logon, indicating that an attacker potentially successfully compromised the account.

Note: This investigation guide uses the Osquery Markdown Plugin 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.
  • Multiple Logon Failure from the same Source Address - 48b6edfc-079d-4907-b43c-baffa243270d

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).

References

Related rules

to-top