Detection rules › YARA-L

GitHub OAuth Application Access Restrictions Disabled

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

Detects when third-party application access restrictions are disabled for a GitHub organization.

References

Telemetry coverage

Rules detecting the same action

These rules filter on the same operation.

Rule body

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

rule github_oauth_application_access_restrictions_disabled {

  meta:
    author = "Google Cloud Security"
    description = "Detects when third-party application access restrictions are disabled for a GitHub organization."
    rule_id = "mr_9faa8dae-8e9f-4c10-9d11-e45eaebe1070"
    rule_name = "GitHub OAuth Application Access Restrictions Disabled"
    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.disable_oauth_app_restrictions"

  outcome:
    $risk_score = max(35)
    $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.

Events

$github

  • metadata.product_event_type = "org.disable_oauth_app_restrictions"

Outcome

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

FieldExpression
risk_scoremax(35)
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)