Detection rules › YARA-L

MITRE ATT&CK T1110.001 Windows Repeated Authentication Failures Before Successful One With User Entity

Severity
medium
Type
alert
Time window
15m
Match by
hostname, target_user
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Detect Multiple Failed Login Attempts followed by Successful Login

MITRE ATT&CK coverage

TacticTechniques
Credential AccessT1110.001 Brute Force: Password Guessing

Event coverage

Rule body yaral

/*
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

rule win_repeatedAuthFailure_thenSuccess_T1110_001_user_asset_entity {

  meta:
    author = "Google Cloud Security"
    description = "Detect Multiple Failed Login Attempts followed by Successful Login"
    rule_id = "mr_2a9dc1d2-d4b8-4b80-a494-3369c681da60"
    rule_name = "MITRE ATT&CK T1110.001 Windows Repeated Authentication Failures Before Successful One With User Entity"
    type = "alert"
    tags = "user entity, asset entity"
    assumption = "Assumes ingestion of Windows users and assets to entity graph to entity graph"
    data_source = "microsoft windows events"
    platform = "Windows"
    severity = "Medium"
    priority = "Medium"
    tactic = "TA0006"
    technique = "T1110.001"

  events:
    $fail.metadata.event_type = "USER_LOGIN"
    $fail.metadata.vendor_name = "Microsoft"
    $fail.principal.hostname = $hostname
    $fail.target.user.userid = $target_user
    $fail.security_result.action = "BLOCK"
    $fail.metadata.product_event_type = "4625"

    $fail.metadata.event_timestamp.seconds < $success.metadata.event_timestamp.seconds

    $success.metadata.event_type = "USER_LOGIN"
    $success.metadata.vendor_name = "Microsoft"
    $success.target.user.userid = $target_user
    $success.principal.hostname = $hostname
    $success.security_result.action = "ALLOW"
    $success.metadata.product_event_type = "4624"

    // Correlate with user entity data
    $user.graph.entity.user.userid = $target_user
    $user.graph.metadata.entity_type = "USER"
    $user.graph.metadata.source_type = "ENTITY_CONTEXT"
    // Can modify the following line to focus the rule on different user groups
    any $user.graph.relations.entity.group.group_display_name = "Domain Admins"

    // Correlate with asset entity data
    $asset.graph.entity.asset.hostname = $hostname
    $asset.graph.metadata.entity_type = "ASSET"
    $asset.graph.metadata.source_type = "ENTITY_CONTEXT"
    // Can modify the following line to focus the rule on different computer groups
    any $asset.graph.relations.entity.group.group_display_name = "Domain Controllers"

  match:
    $target_user, $hostname over 15m

    outcome:
    //increment risk score if the system targeted is active directory server, can modify as you see fit, using this as an example
    $risk_score = max(if($hostname = /activedir/, 75, 50))
    $failed_login_threshold = 5
    $impacted_systems = array_distinct($hostname)
    $impacted_users = array_distinct($target_user)
    $alert_type = "Successful Brute Force Attack"
    $tlp = "red"
    // added to populate alert graph with additional context
    // Commented out principal.hostname because it is already represented in graph as match variable. If match changes, can uncomment to add to results
    //$principal_hostname = array_distinct($success.principal.hostname)
    $principal_ip = array_distinct($success.principal.ip)
    $target_hostname = array_distinct($success.target.hostname)
    $src_hostname = array_distinct($success.src.hostname)
    $target_ip = array_distinct($success.target.ip)
    $principal_user_userid = array_distinct($success.principal.user.userid)
    // Commented out target.user.userid because it is already represented in graph as match variable. If match changes, can uncomment to add to results
    //$target_user_userid = array_distinct($success.target.user.userid)
    $principal_resource_name = array_distinct($success.principal.resource.name)
    $target_resource_name = array_distinct($success.target.resource.name)
    $target_url = array_distinct($success.target.url)

  condition:
    #fail > 4 and $success and $user and $asset
}

Detection logic

Fires when $fail occurs more than 4 times in the 15m window and at least one $success event in the 15m window and $user matches entity context and $asset matches entity context.

Events

$asset entity context (ASSET)

  • graph.metadata.entity_type = "ASSET"
  • graph.metadata.source_type = "ENTITY_CONTEXT"
  • graph.relations.entity.group.group_display_name = "Domain Controllers"

$fail USER_LOGIN (4625)

  • security_result.action = "BLOCK"
  • metadata.product_event_type = "4625"

$success USER_LOGIN (4624)

  • security_result.action = "ALLOW"
  • metadata.product_event_type = "4624"

$user entity context (USER)

  • graph.metadata.entity_type = "USER"
  • graph.metadata.source_type = "ENTITY_CONTEXT"
  • graph.relations.entity.group.group_display_name = "Domain Admins"

Correlation

Order
$fail before $success
Match key
$hostname (principal.hostname), $target_user (target.user.userid)
Within
15m

Outcome

Fields the detection emits on a match. $risk_score drives alerting; Chronicle surfaces the rest on the detection.

FieldExpression
risk_scoremax(if($hostname = /activedir/, 75, 50))
failed_login_threshold5
impacted_systemsarray_distinct($hostname)
impacted_usersarray_distinct($target_user)
principal_iparray_distinct($success.principal.ip)
target_hostnamearray_distinct($success.target.hostname)
src_hostnamearray_distinct($success.src.hostname)
target_iparray_distinct($success.target.ip)
principal_user_useridarray_distinct($success.principal.user.userid)
principal_resource_namearray_distinct($success.principal.resource.name)
target_resource_namearray_distinct($success.target.resource.name)
target_urlarray_distinct($success.target.url)