Detection rules › YARA-L

GitHub Secret Scanning Disabled Or Bypassed

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

Detects when components of GitHub secret scanning is disabled for an enterprise or organization.

MITRE ATT&CK coverage

References

Event coverage

Rules detecting the same action

Other rules on this platform that filter on the same API call or operation.

Rule body yaral

/*
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

rule github_secret_scanning_disabled_or_bypassed {

  meta:
    author = "Google Cloud Security"
    description = "Detects when components of GitHub secret scanning is disabled for an enterprise or organization."
    rule_id = "mr_982454f3-81ab-491a-b61c-bae718d6028e"
    rule_name = "GitHub Secret Scanning Disabled Or Bypassed"
    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"
    mitre_attack_tactic = "Defense Evasion"
    mitre_attack_technique = "Impair Defenses: Disable or Modify Tools"
    mitre_attack_url = "https://attack.mitre.org/versions/v14/techniques/T1562/001/"
    mitre_attack_version = "v14"
    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 = "secret_scanning.disable" or
        $github.metadata.product_event_type = "secret_scanning_new_repos.disable" or
        $github.metadata.product_event_type = "secret_scanning_push_protection.bypass" or
        $github.metadata.product_event_type = "business_secret_scanning_custom_pattern_push_protection.disabled" or
        $github.metadata.product_event_type = "business_secret_scanning.disable" or
        $github.metadata.product_event_type = "business_secret_scanning.disabled_for_new_repos" or
        $github.metadata.product_event_type = "business_secret_scanning_push_protection_custom_message.disable" or
        $github.metadata.product_event_type = "business_secret_scanning_push_protection.disable" or
        $github.metadata.product_event_type = "business_secret_scanning_push_protection.disabled_for_new_repos" or
        $github.metadata.product_event_type = "org_secret_scanning_generic_secrets.disabled" or
        $github.metadata.product_event_type = "repository_secret_scanning.disable" or
        $github.metadata.product_event_type = "repository_secret_scanning_generic_secrets.disabled" or
        $github.metadata.product_event_type = "repository_secret_scanning_push_protection.disable"
    )

  outcome:
    $risk_score = max(85)
    $mitre_attack_tactic = "Defense Evasion"
    $mitre_attack_technique = "Impair Defenses: Disable or Modify Tools"
    $mitre_attack_technique_id = "T1562.001"
    $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 logic

Fires when at least one $github event.

Events

$github

  • metadata.product_event_type = "secret_scanning.disable" or "secret_scanning_new_repos.disable" or "secret_scanning_push_protection.bypass" or "business_secret_scanning_custom_pattern_push_protection.disabled" or "business_secret_scanning.disable" or "business_secret_scanning.disabled_for_new_repos" or "business_secret_scanning_push_protection_custom_message.disable" or "business_secret_scanning_push_protection.disable" or "business_secret_scanning_push_protection.disabled_for_new_repos" or "org_secret_scanning_generic_secrets.disabled" or "repository_secret_scanning.disable" or "repository_secret_scanning_generic_secrets.disabled" or "repository_secret_scanning_push_protection.disable"

Outcome

Fields the detection emits on a match. $risk_score drives alerting; Chronicle surfaces the rest on the detection.

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