Detection rules › YARA-L

YARA-L rules: 2c

AWS API Call Outside Of Organization

#
Severity
high
Type
Alert
Time window
1h
Match by
accountId
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Detects API Calls from AWS accounts that are not part of the organization.

MITRE ATT&CK Coverage

Rule Body

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

rule aws_api_call_outside_of_organization {

  meta:
    author = "Google Cloud Security"
    description = "Detects API Calls from AWS accounts that are not part of the organization."
    rule_id = "mr_205120b7-6654-410a-ab6d-e40484e2fafb"
    rule_name = "AWS API Call Outside Of Organization"
    mitre_attack_tactic = "Defense Evasion, Persistence, Privilege Escalation, Initial Access"
    mitre_attack_technique = "Valid Accounts: Cloud Accounts"
    mitre_attack_url = "https://attack.mitre.org/techniques/T1078/004/"
    mitre_attack_version = "v13.1"
    type = "Alert"
    data_source = "AWS CloudTrail"
    platform = "AWS"
    severity = "High"
    priority = "High"

  events:
    $cloudtrail.metadata.vendor_name = "AMAZON"
    $cloudtrail.metadata.product_name = "AWS CloudTrail"
    // Requires a Reference List named aws_accounts with a list of approved and known AWS Account IDs
    not $cloudtrail.principal.user.group_identifiers in %aws_accounts
    not $cloudtrail.target.user.group_identifiers in %aws_accounts
    $cloudtrail.additional.fields["recipientAccountId"] = $accountId

  match:
    $accountId over 1h

  outcome:
    $risk_score = max(75)
    $mitre_attack_tactic = "Defense Evasion, Persistence, Privilege Escalation, Initial Access"
    $mitre_attack_technique = "Valid Accounts: Cloud Accounts"
    $mitre_attack_technique_id = "T1078.004"
    $event_count = count_distinct($cloudtrail.metadata.id)
    $network_http_user_agent = array_distinct($cloudtrail.network.http.user_agent)
    $principal_ip = array_distinct($cloudtrail.principal.ip)
    $principal_ip_country = array_distinct($cloudtrail.principal.ip_geo_artifact.location.country_or_region)
    $principal_ip_state = array_distinct($cloudtrail.principal.ip_geo_artifact.location.state)
    $principal_user_display_name = array_distinct($cloudtrail.principal.user.user_display_name)
    $recipient_aws_account_id = array_distinct($cloudtrail.additional.fields["recipientAccountId"])
    $aws_region = array_distinct($cloudtrail.principal.location.name)
    $product_event_type = array_distinct($cloudtrail.metadata.product_event_type)
    $target_resource_name = array_distinct($cloudtrail.target.resource.name)
    $target_resource_product_object_id = array_distinct($cloudtrail.target.resource.product_object_id)

  condition:
    $cloudtrail
}

YARA-L Rule Structure

Condition

Fires when at least one $cloudtrail event in the 1h window.

Events

$cloudtrail

  • principal.user.group_identifiers in "%aws_accounts"
  • target.user.group_identifiers in "%aws_accounts"

Match and Correlation

Match key
$accountId (additional.fields["recipientAccountId"])
Within
1h

Outcome

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

FieldExpression
risk_scoremax(75)
event_countcount_distinct($cloudtrail.metadata.id)
network_http_user_agentarray_distinct($cloudtrail.network.http.user_agent)
principal_iparray_distinct($cloudtrail.principal.ip)
principal_ip_countryarray_distinct($cloudtrail.principal.ip_geo_artifact.location.country_or_region)
principal_ip_statearray_distinct($cloudtrail.principal.ip_geo_artifact.location.state)
principal_user_display_namearray_distinct($cloudtrail.principal.user.user_display_name)
recipient_aws_account_idarray_distinct($cloudtrail.additional.fields["recipientAccountId"])
aws_regionarray_distinct($cloudtrail.principal.location.name)
product_event_typearray_distinct($cloudtrail.metadata.product_event_type)
target_resource_namearray_distinct($cloudtrail.target.resource.name)
target_resource_product_object_idarray_distinct($cloudtrail.target.resource.product_object_id)

AWS IAM Access Analyzer Deleted

#
Severity
low
Type
Alert
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Detects when AWS IAM Access Analyzer is deleted.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

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

rule aws_iam_access_analyzer_deleted {

  meta:
    author = "Google Cloud Security"
    description = "Detects when AWS IAM Access Analyzer is deleted."
    rule_id = "mr_c1c8c5e4-ad04-40de-b42e-9d1086360796"
    rule_name = "AWS IAM Access Analyzer Deleted"
    mitre_attack_tactic = "Defense Evasion"
    mitre_attack_technique = "Impair Defenses: Disable Cloud Logs"
    mitre_attack_url = "https://attack.mitre.org/techniques/T1562/008/"
    mitre_attack_version = "v15.1"
    type = "Alert"
    data_source = "AWS CloudTrail"
    platform = "AWS"
    severity = "Low"
    priority = "Low"

  events:
    $cloudtrail.metadata.vendor_name = "AMAZON"
    $cloudtrail.metadata.product_name = "AWS CloudTrail"
    $cloudtrail.metadata.event_type = "RESOURCE_DELETION"
    $cloudtrail.metadata.product_event_type = "DeleteAnalyzer"
    $cloudtrail.security_result.action = "ALLOW"

  outcome:
    $risk_score = max(35)
    $mitre_attack_tactic = "Defense Evasion"
    $mitre_attack_technique = "Impair Defenses: Disable Cloud Logs"
    $mitre_attack_technique_id = "T1562.008"
    $event_count = count_distinct($cloudtrail.metadata.id)
    $network_http_user_agent = array_distinct($cloudtrail.network.http.user_agent)
    $principal_ip = array_distinct($cloudtrail.principal.ip)
    $principal_ip_country = array_distinct($cloudtrail.principal.ip_geo_artifact.location.country_or_region)
    $principal_ip_state = array_distinct($cloudtrail.principal.ip_geo_artifact.location.state)
    $principal_user_display_name = array_distinct($cloudtrail.principal.user.user_display_name)
    $recipient_aws_account_id = array_distinct($cloudtrail.additional.fields["recipientAccountId"])
    $aws_region = array_distinct($cloudtrail.principal.location.name)
    $target_resource_name = array_distinct($cloudtrail.target.resource.name)

  condition:
    $cloudtrail
}

YARA-L Rule Structure

Condition

Fires when at least one $cloudtrail event.

Events

$cloudtrail RESOURCE_DELETION

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

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($cloudtrail.metadata.id)
network_http_user_agentarray_distinct($cloudtrail.network.http.user_agent)
principal_iparray_distinct($cloudtrail.principal.ip)
principal_ip_countryarray_distinct($cloudtrail.principal.ip_geo_artifact.location.country_or_region)
principal_ip_statearray_distinct($cloudtrail.principal.ip_geo_artifact.location.state)
principal_user_display_namearray_distinct($cloudtrail.principal.user.user_display_name)
recipient_aws_account_idarray_distinct($cloudtrail.additional.fields["recipientAccountId"])
aws_regionarray_distinct($cloudtrail.principal.location.name)
target_resource_namearray_distinct($cloudtrail.target.resource.name)

Google Workspace Custom Admin Role Created

#
Severity
high
Type
Alert
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Identifies when a custom administrator role is created in Google Workspace. Security teams can monitor for malicious or accidental configuration of administrator privileges to prevent unauthorized access to data.

MITRE ATT&CK Coverage

Telemetry Coverage

PlatformRecord / event type
Google WorkspaceCREATE_ROLE: Create Role

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

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

rule google_workspace_custom_admin_role_created {

  meta:
    author = "Google Cloud Security"
    description = "Identifies when a custom administrator role is created in Google Workspace. Security teams can monitor for malicious or accidental configuration of administrator privileges to prevent unauthorized access to data."
    rule_id = "mr_a15f64fc-3eaf-49f0-9f74-c533a63cb531"
    rule_name = "Google Workspace Custom Admin Role Created"
    mitre_attack_tactic = "Persistence"
    mitre_attack_technique = "Account Manipulation: Additional Cloud Roles"
    mitre_attack_url = "https://attack.mitre.org/techniques/T1098/003/"
    mitre_attack_version = "v13.1"
    type = "Alert"
    data_source = "Workspace Activity"
    severity = "High"
    priority = "High"

  events:
    $ws.metadata.vendor_name = "Google Workspace"
    $ws.metadata.product_name = "admin"
    $ws.metadata.event_type = "USER_RESOURCE_CREATION"
    $ws.metadata.product_event_type = "CREATE_ROLE"
    $ws.security_result.category_details = "DELEGATED_ADMIN_SETTINGS"

  outcome:
    $risk_score = max(85)
    $mitre_attack_tactic = "Persistence"
    $mitre_attack_technique = "Account Manipulation: Additional Cloud Roles"
    $mitre_attack_technique_id = "T1098.003"
    $event_count = count_distinct($ws.metadata.id)
    $principal_ip = array_distinct($ws.principal.ip)
    $principal_country = array_distinct($ws.principal.ip_geo_artifact.location.country_or_region)
    $principal_state = array_distinct($ws.principal.ip_geo_artifact.location.state)
    $principal_user_emails = array_distinct($ws.principal.user.email_addresses)
    $target_user_emails = array_distinct($ws.target.user.email_addresses)
    $principal_user_id = $ws.principal.user.userid
    $role_id = $ws.target.resource.attribute.labels["role_id"]
    $role_name = array_distinct($ws.target.resource.attribute.roles.name)

  condition:
    $ws
}

YARA-L Rule Structure

Condition

Fires when at least one $ws event.

Events

$ws USER_RESOURCE_CREATION

  • metadata.product_event_type = "CREATE_ROLE"
  • security_result.category_details = "DELEGATED_ADMIN_SETTINGS"

Outcome

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

FieldExpression
risk_scoremax(85)
event_countcount_distinct($ws.metadata.id)
principal_iparray_distinct($ws.principal.ip)
principal_countryarray_distinct($ws.principal.ip_geo_artifact.location.country_or_region)
principal_statearray_distinct($ws.principal.ip_geo_artifact.location.state)
principal_user_emailsarray_distinct($ws.principal.user.email_addresses)
target_user_emailsarray_distinct($ws.target.user.email_addresses)
principal_user_id$ws.principal.user.userid
role_id$ws.target.resource.attribute.labels["role_id"]
role_namearray_distinct($ws.target.resource.attribute.roles.name)

sap gateway acl bypass attempt

#
Severity
low
Time window
30m
Match by
source_ip
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Detects rejected connections by Gateway ACLs (secinfo/reginfo), indicating an attempt to bypass network-layer security.

MITRE ATT&CK Coverage

TacticTechniques
Initial Access

Rule Body

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

rule sap_gateway_acl_bypass_attempt {

  meta:
    author = "Google Cloud Security"
    description = "Detects rejected connections by Gateway ACLs (secinfo/reginfo), indicating an attempt to bypass network-layer security."
    severity = "Low"
    tactic = "TA0001"
    technique = "T1190"

  events:
    $e.metadata.product_name = "SAP_GATEWAY"

    $e.additional.fields["event_action"] = /secinfo|reginfo/ nocase

    $e.security_result.action = "BLOCK"

    $source_ip = $e.principal.ip

  match:
    $source_ip over 30m

  outcome:
    $risk_score = 5
    $acl_type = array_distinct($e.additional.fields["event_action"])
    $attempted_programs = array_distinct($e.target.process.file.full_path)
    $error_details = array_distinct($e.security_result.description)
    $user_context = array_distinct($e.principal.user.userid)
    $total_denials = count($e.metadata.product_log_id)

  condition:
    $e
}

YARA-L Rule Structure

Condition

Fires when at least one $e event in the 30m window.

Events

$e

  • additional.fields["event_action"] matches "secinfo|reginfo"
  • security_result.action = "BLOCK"

Match and Correlation

Match key
$source_ip
Within
30m

Outcome

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

FieldExpression
risk_score5
acl_typearray_distinct($e.additional.fields["event_action"])
attempted_programsarray_distinct($e.target.process.file.full_path)
error_detailsarray_distinct($e.security_result.description)
user_contextarray_distinct($e.principal.user.userid)
total_denialscount($e.metadata.product_log_id)

Back to all YARA-L rules