Detection rules › YARA-L

YARA-L rules: 0h

GitHub User Unblocked From Accessing Organization Repositories

#
Severity
low
Type
alert
Time window
30m
Match by
actor_user_id, target_user_id
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Detects when a user is unblocked from accessing repositories within a GitHub organization.

References

Telemetry Coverage

Rule Body

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

rule github_user_unblocked_from_accessing_organization_repositories {

  meta:
    author = "Google Cloud Security"
    description = "Detects when a user is unblocked from accessing repositories within a GitHub organization."
    rule_id = "mr_3a6905e8-e5e1-40af-b911-52bc4918d2ba"
    rule_name = "GitHub User Unblocked From Accessing Organization Repositories"
    assumption = "Your GitHub enterprise audit log settings are configured to log the source IP address for events. Reference: https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/displaying-ip-addresses-in-the-audit-log-for-your-organization"
    type = "alert"
    severity = "Low"
    priority = "Low"
    platform = "GitHub"
    data_source = "github"
    reference = "https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise"

  events:
    $github.metadata.vendor_name = "GITHUB" nocase
    $github.metadata.product_name = "GITHUB"
    $github.metadata.product_event_type = "org.unblock_user"
    $github.principal.user.userid = $actor_user_id
    $github.extracted.fields["blocked_user"] = $target_user_id

  match:
    $actor_user_id, $target_user_id over 30m

  outcome:
    $risk_score = max(35)
    $event_count = count_distinct($github.metadata.id)
    $principal_ip = array_distinct($github.principal.ip)
    $principal_user_userid = array_distinct($github.principal.user.userid)
    $principal_ip_country = array_distinct($github.principal.ip_geo_artifact.location.country_or_region)
    $principal_ip_state = array_distinct($github.principal.ip_geo_artifact.location.state)
    $principal_ip_city = array_distinct($github.principal.location.city)
    $security_result_summary = array_distinct($github.security_result.summary)

  condition:
    $github
}

YARA-L Rule Structure

Condition

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

Events

$github

  • metadata.product_event_type = "org.unblock_user"

Match and Correlation

Match key
$actor_user_id (principal.user.userid), $target_user_id (extracted.fields["blocked_user"])
Within
30m

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($github.metadata.id)
principal_iparray_distinct($github.principal.ip)
principal_user_useridarray_distinct($github.principal.user.userid)
principal_ip_countryarray_distinct($github.principal.ip_geo_artifact.location.country_or_region)
principal_ip_statearray_distinct($github.principal.ip_geo_artifact.location.state)
principal_ip_cityarray_distinct($github.principal.location.city)
security_result_summaryarray_distinct($github.security_result.summary)

IOC Domain C2

#
Severity
high
Type
alert
Time window
5m
Match by
dns_query
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Detect DNS events that indicate communication to a C2 domain in MISP

Telemetry Coverage

ProviderRecord / event type
SysmonEvent ID 22: DNSEvent (DNS query)

Rule Body

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

rule ioc_domain_C2 {

  meta:
    author = "Google Cloud Security"
    description = "Detect DNS events that indicate communication to a C2 domain in MISP"
    rule_id = "mr_cb22c45e-b29d-487f-9cf5-1310bfed6d6c"
    rule_name = "IOC Domain C2"
    type = "alert"
    tags = "threat indicators"
    assumption = "Assumes MISP data has been ingested into entity graph; this rule can be modified to utilize other TI indicators"
    data_source = "microsoft sysmon"
    severity = "High"
    priority = "High"

  events:
    $dns.metadata.event_type = "NETWORK_DNS"
    $dns.network.dns.questions.name = $dns_query

    // Correlates with MISP data; can be modified based on your MISP parser or other TI
    $ioc.graph.metadata.product_name = "MISP"
    $ioc.graph.metadata.entity_type = "DOMAIN_NAME"
    $ioc.graph.metadata.source_type = "ENTITY_CONTEXT"
    //Summary is used to focus on a specific subset of MISP indicators, can modify as needed
    $ioc.graph.metadata.threat.summary = "C2 domains"
    $ioc.graph.entity.hostname = $dns_query

  match:
    $dns_query over 5m

  outcome:
    $risk_score = 85
    $event_count = count_distinct($dns.metadata.id)
    $network_dns_questions_name = array_distinct($dns.network.dns.questions.name)
    $network_dns_answers_data = array_distinct($dns.network.dns.answers.data)
    // added to populate alert graph with additional context
    $principal_ip = array_distinct($dns.principal.ip)
    $target_ip = array_distinct($dns.target.ip)
    $principal_process_pid = array_distinct($dns.principal.process.pid)
    $principal_process_file_full_path = array_distinct($dns.principal.process.file.full_path)
    $principal_process_product_specific_process_id = array_distinct($dns.principal.process.product_specific_process_id)
    $principal_user_userid = array_distinct($dns.principal.user.userid)
    $principal_process_command_line = array_distinct($dns.principal.process.command_line)
    $principal_process_file_sha256 = array_distinct($dns.principal.process.file.sha256)
    $principal_process_parent_process_product_specific_process_id = array_distinct($dns.principal.process.parent_process.product_specific_process_id)


  condition:
    $dns and $ioc
}

YARA-L Rule Structure

Condition

Fires when at least one $dns event in the 5m window and $ioc matches entity context.

Events

$dns NETWORK_DNS (22)

No field filters (binds the event for correlation only).

$ioc entity context (DOMAIN_NAME)

  • graph.metadata.product_name = "MISP"
  • graph.metadata.entity_type = "DOMAIN_NAME"
  • graph.metadata.source_type = "ENTITY_CONTEXT"
  • graph.metadata.threat.summary = "C2 domains"

Match and Correlation

Match key
$dns_query (network.dns.questions.name)
Within
5m

Outcome

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

FieldExpression
risk_score85
event_countcount_distinct($dns.metadata.id)
network_dns_questions_namearray_distinct($dns.network.dns.questions.name)
network_dns_answers_dataarray_distinct($dns.network.dns.answers.data)
principal_iparray_distinct($dns.principal.ip)
target_iparray_distinct($dns.target.ip)
principal_process_pidarray_distinct($dns.principal.process.pid)
principal_process_file_full_patharray_distinct($dns.principal.process.file.full_path)
principal_process_product_specific_process_idarray_distinct($dns.principal.process.product_specific_process_id)
principal_user_useridarray_distinct($dns.principal.user.userid)
principal_process_command_linearray_distinct($dns.principal.process.command_line)
principal_process_file_sha256array_distinct($dns.principal.process.file.sha256)
principal_process_parent_process_product_specific_process_idarray_distinct($dns.principal.process.parent_process.product_specific_process_id)

O365 OneDrive Anonymous Link Created or Updated

#

Office 365 group deletion success

#
Severity
low
Type
alert
Time window
5m
Match by
user
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Detects when a group is deleted.

Telemetry Coverage

PlatformRecord / event type
Microsoft 365Delete group.

Rule Body

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

 rule o365_group_deletion_success {

  meta:
    author = "Google Cloud Security"
    description = "Detects when a group is deleted."
    rule_id = "mr_24a45257-b6b5-4b1d-b301-526dc6a17adf"
    rule_name = "Office 365 group deletion success"
    type = "alert"
    platform = "azure"
    data_source = "o365"
    severity = "Low"
    priority = "Low"

  events:
    $group.metadata.event_type = "GROUP_DELETION"
    $group.metadata.product_event_type = "Delete group."
    $group.metadata.product_name = "Office 365"
    $group.metadata.vendor_name = "Microsoft"
    $group.security_result.action = "ALLOW"
    $group.principal.user.userid = $user

  match:
    $user over 5m

  outcome:
    $risk_score = 35
    $event_count = count_distinct($group.metadata.id)
    $user_agent = array_distinct($group.network.http.user_agent)
    $security_summary = array_distinct($group.security_result.summary)
    $target_application = array_distinct($group.target.application)
    //$principal_user_userid = array_distinct($group.principal.user.userid)
    $group_name = array_distinct($group.target.group.group_display_name)
    $group_guid = array_distinct(re.replace($group.security_result.detection_fields["target_2"],`Group_`,""))

  condition:
    $group
}

YARA-L Rule Structure

Condition

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

Events

$group GROUP_DELETION

  • metadata.product_event_type = "Delete group."
  • security_result.action = "ALLOW"

Match and Correlation

Match key
$user (principal.user.userid)
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($group.metadata.id)
user_agentarray_distinct($group.network.http.user_agent)
security_summaryarray_distinct($group.security_result.summary)
target_applicationarray_distinct($group.target.application)
group_namearray_distinct($group.target.group.group_display_name)
group_guidarray_distinct(re.replace($group.security_result.detection_fields["target_2"],`Group_`,""))

Okta User Failed Number Challenge During Push Notification

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

Detects when an Okta user failed a number challenge during push notification.

MITRE ATT&CK Coverage

References

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

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

rule okta_user_failed_number_challenge_during_push_notification {

  meta:
    author = "Google Cloud Security"
    description = "Detects when an Okta user failed a number challenge during push notification."
    rule_id = "mr_c5542a92-03d7-463a-bab8-ad10a6cd42f0"
    rule_name = "Okta User Failed Number Challenge During Push Notification"
    reference = "https://support.okta.com/help/s/article/Number-Challenge-for-Okta-Verify"
    mitre_attack_tactic = "Credential Access"
    mitre_attack_technique = "Multi-Factor Authentication Request Generation"
    mitre_attack_url = "https://attack.mitre.org/techniques/T1621/"
    mitre_attack_version = "v13.1"
    type = "Alert"
    data_source = "Okta"
    severity = "Medium"
    priority = "Medium"

  events:
    $login.metadata.product_name = "Okta"
    $login.metadata.vendor_name = "Okta"
    $login.metadata.event_type = "USER_LOGIN"
    $login.metadata.product_event_type = "user.authentication.auth_via_mfa"
    $login.security_result.detection_fields["pushWithNumberChallengeResponseType"] = "OV_WITH_CHALLENGE_RESPONSE_INVALID"
    $login.security_result.action = "BLOCK"
    $login.target.user.userid = $userid

  match:
    $userid over 1h

  outcome:
    $risk_score = max(35)
    $mitre_attack_tactic = "Credential Access"
    $mitre_attack_technique = "Multi-Factor Authentication Request Generation"
    $target_user_agent = array_distinct($login.network.http.user_agent)
    $principal_ip = array_distinct($login.principal.ip)
    $principal_ip_country = array_distinct($login.principal.ip_geo_artifact.location.country_or_region)
    $principal_ip_state = array_distinct($login.principal.ip_geo_artifact.location.state)
    $principal_ip_city = array_distinct($login.principal.location.city)
    $principal_user_email_addresses = array_distinct ($login.principal.user.email_addresses)
    $security_result_summary = array_distinct($login.security_result.summary)
    $target_user_email_addresses = array_distinct($login.target.user.email_addresses)
    $target_user_userid = array_distinct($login.target.user.userid)

  condition:
    $login
}

YARA-L Rule Structure

Condition

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

Events

$login USER_LOGIN

  • metadata.product_event_type = "user.authentication.auth_via_mfa"
  • security_result.detection_fields["pushWithNumberChallengeResponseType"] = "OV_WITH_CHALLENGE_RESPONSE_INVALID"
  • security_result.action = "BLOCK"

Match and Correlation

Match key
$userid (target.user.userid)
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(35)
target_user_agentarray_distinct($login.network.http.user_agent)
principal_iparray_distinct($login.principal.ip)
principal_ip_countryarray_distinct($login.principal.ip_geo_artifact.location.country_or_region)
principal_ip_statearray_distinct($login.principal.ip_geo_artifact.location.state)
principal_ip_cityarray_distinct($login.principal.location.city)
principal_user_email_addressesarray_distinct ($login.principal.user.email_addresses)
security_result_summaryarray_distinct($login.security_result.summary)
target_user_email_addressesarray_distinct($login.target.user.email_addresses)
target_user_useridarray_distinct($login.target.user.userid)

Back to all YARA-L rules