github_invitation_sent_to_non_company_email_domain


Description

Detects when an invitation to join a GitHub enterprise or organization is sent to a non-company email address. This rule can be customized to alert you when a GitHub invitation is sent to an unexpected domain i.e. not one of your company's domains used for email.

Query · yara_l

events:
    $github.metadata.vendor_name = "GITHUB" nocase
    $github.metadata.product_name = "GITHUB"
    (
        $github.metadata.product_event_type = "business.invite_admin" or
        $github.metadata.product_event_type = "business.invite_billing_manager" or
        $github.metadata.product_event_type = "org.invite_member"
    )

    // Filter events based on the invitee's email address. Customize the regex expression to fit your environment i.e. alert on invites sent to domains that are not managed by your company
    $github.extracted.fields["invitee_email"] != /@my-company-domain-name\.com/ nocase
    $github.extracted.fields["invitee_email"] = $invitee_email

  match:
    $invitee_email over 30m

  outcome:
    $risk_score = max(85)
    $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
Raw source github_invitation_sent_to_non_company_email_domain · YARA-L
Esc
Published by chronicle/detection-rules ↗, licensed under Apache 2.0 ↗. Reproduced here unmodified.
rule github_invitation_sent_to_non_company_email_domain {

  meta:
    author = "Google Cloud Security"
    description = "Detects when an invitation to join a GitHub enterprise or organization is sent to a non-company email address. This rule can be customized to alert you when a GitHub invitation is sent to an unexpected domain i.e. not one of your company's domains used for email."
    rule_id = "mr_c191df42-006f-485a-b037-f0cbf737bdd4"
    rule_name = "GitHub Invitation Sent To Non Company Email Domain"
    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 = "High"
    priority = "High"
    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 = "business.invite_admin" or
        $github.metadata.product_event_type = "business.invite_billing_manager" or
        $github.metadata.product_event_type = "org.invite_member"
    )

    // Filter events based on the invitee's email address. Customize the regex expression to fit your environment i.e. alert on invites sent to domains that are not managed by your company
    $github.extracted.fields["invitee_email"] != /@my-company-domain-name\.com/ nocase
    $github.extracted.fields["invitee_email"] = $invitee_email

  match:
    $invitee_email over 30m

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

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.