Detection rules › YARA-L

YARA-L rules: 30

AWS High Number Of Unknown User Authentication Attempts

#
Severity
low
Type
Alert
Time window
10m
Match by
ip
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Detects when a high number of failed authentication attempts happen for unknown users.

MITRE ATT&CK Coverage

TacticTechniques
Credential Access

Telemetry Coverage

Rule Body

// Copyright 2023 Google LLC. Licensed under Apache-2.0.

rule aws_high_number_of_unknown_user_authentication_attempts {

  meta:
    author = "Google Cloud Security"
    description = "Detects when a high number of failed authentication attempts happen for unknown users."
    rule_id = "mr_3ddfee11-c959-4283-8fb4-1f57bdaaf2b1"
    rule_name = "AWS High Number Of Unknown User Authentication Attempts"
    mitre_attack_tactic = "Credential Access"
    mitre_attack_technique = "Brute Force: Credential Stuffing"
    mitre_attack_url = "https://attack.mitre.org/techniques/T1110/004/"
    mitre_attack_version = "v13.1"
    type = "Alert"
    data_source = "AWS CloudTrail"
    platform = "AWS"
    severity = "Low"
    priority = "Low"

  events:
    $fail.metadata.vendor_name = "AMAZON"
    $fail.metadata.product_name = "AWS CloudTrail"
    $fail.metadata.event_type = "USER_LOGIN"
    $fail.metadata.product_event_type = "ConsoleLogin"
    $fail.security_result.action = "BLOCK"
    $fail.security_result.description = "Reason: No username found in supplied account"
    $fail.principal.ip = $ip

  match:
    $ip over 10m

  outcome:
    $risk_score = max(35)
    $mitre_attack_tactic = "Credential Access"
    $mitre_attack_technique = "Brute Force: Credential Stuffing"
    $mitre_attack_technique_id = "T1110.004"
    $event_count = count_distinct($fail.metadata.id)
    $network_http_user_agent = array_distinct($fail.network.http.user_agent)
    $principal_ip = array_distinct($fail.principal.ip)
    $principal_ip_country = array_distinct($fail.principal.ip_geo_artifact.location.country_or_region)
    $principal_ip_state = array_distinct($fail.principal.ip_geo_artifact.location.state)
    $target_user_display_name = array_distinct($fail.target.user.user_display_name)
    $recipient_aws_account_id = array_distinct($fail.additional.fields["recipientAccountId"])
    $target_resource_name = array_distinct($fail.target.resource.name)
    $target_resource_product_object_id = array_distinct($fail.target.resource.product_object_id)
    $security_result_description = array_distinct($fail.security_result.description)

  condition:
    #fail >= 10
}

YARA-L Rule Structure

Condition

Fires when $fail occurs at least 10 times in the 10m window.

Events

$fail USER_LOGIN

  • metadata.product_event_type = "ConsoleLogin"
  • security_result.action = "BLOCK"
  • security_result.description = "Reason: No username found in supplied account"

Match and Correlation

Match key
$ip (principal.ip)
Within
10m

Outcome

Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.

FieldExpression
risk_scoremax(35)
event_countcount_distinct($fail.metadata.id)
network_http_user_agentarray_distinct($fail.network.http.user_agent)
principal_iparray_distinct($fail.principal.ip)
principal_ip_countryarray_distinct($fail.principal.ip_geo_artifact.location.country_or_region)
principal_ip_statearray_distinct($fail.principal.ip_geo_artifact.location.state)
target_user_display_namearray_distinct($fail.target.user.user_display_name)
recipient_aws_account_idarray_distinct($fail.additional.fields["recipientAccountId"])
target_resource_namearray_distinct($fail.target.resource.name)
target_resource_product_object_idarray_distinct($fail.target.resource.product_object_id)
security_result_descriptionarray_distinct($fail.security_result.description)

Hunt for search/query endpoint API requests in the Microsoft Graph

#
Severity
low
Type
hunt
Time window
5m
Match by
ip, session
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

This detects when the search/query endpoint is called which can be used for enumeration of items like SharePoint site URLs. GraphRunner contains a function called Get-SharePointSiteURLs but other tools may as well.

References

Rule Body

// Copyright 2025 Google LLC. Licensed under Apache-2.0.

rule ms_graph_search_query {

  meta:
    author = "Google Cloud Security"
    description = "This detects when the search/query endpoint is called which can be used for enumeration of items like SharePoint site URLs. GraphRunner contains a function called Get-SharePointSiteURLs but other tools may as well."
    rule_id = "mr_19ac0f85-970c-4eca-9832-72aaed1ee311"
    rule_name = "Hunt for search/query endpoint API requests in the Microsoft Graph"
    reference = "https://github.com/dafthack/GraphRunner/blob/main/GraphRunner.ps1"
    assumption = "Applications that perform this action will need to be filtered and thresholding in the condition could be added for additional tuning as needed"
    type = "hunt"
    data_source = "MS Graph Activity Logs"
    platform = "Azure"
    severity = "Low"
    priority = "Low"

  events:
    $api.metadata.event_type = "NETWORK_HTTP"
    $api.metadata.product_event_type = "Microsoft Graph Activity"
    $api.target.url = "https://graph.microsoft.com/v1.0/search/query" nocase
    //Can be tuned for specific User Agent strings being used - by default GraphRunner does not forge the UA for this action
    //$api.network.http.user_agent = /PowerShell/ nocase
    $api.network.http.method = "POST"
    $api.network.http.response_code = 200
    $api.principal.ip = $ip
    $api.network.session_id = $session

  match:
    $ip, $session over 5m

  outcome:
    $risk_score = 35
    $event_count = count_distinct($api.metadata.id)
    $requesting_user_guid = array_distinct($api.principal.user.userid)
    $requesting_ip = array_distinct($api.principal.ip)
    $user_agent = array_distinct($api.network.http.user_agent)
    $location = array_distinct($api.principal.location.name)
    $target_application_id_guid = array_distinct($api.target.resource.product_object_id)
    $session_id = array_distinct($api.network.session_id)
    $target_url = array_distinct($api.target.url)

  condition:
    $api
}

YARA-L Rule Structure

Condition

Fires when at least one $api event in the 5m window.

Events

$api NETWORK_HTTP

  • metadata.product_event_type = "Microsoft Graph Activity"
  • target.url = "https://graph.microsoft.com/v1.0/search/query"
  • network.http.method = "POST"
  • network.http.response_code = "200"

Match and Correlation

Match key
$ip (principal.ip), $session (network.session_id)
Within
5m

Outcome

Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.

FieldExpression
risk_score35
event_countcount_distinct($api.metadata.id)
requesting_user_guidarray_distinct($api.principal.user.userid)
requesting_iparray_distinct($api.principal.ip)
user_agentarray_distinct($api.network.http.user_agent)
locationarray_distinct($api.principal.location.name)
target_application_id_guidarray_distinct($api.target.resource.product_object_id)
session_idarray_distinct($api.network.session_id)
target_urlarray_distinct($api.target.url)

Back to all YARA-L rules