Detection rules for GitHub Data sources. Every rule contains its MITRE ATT&CK mapping, an impact rating, and details on what it identifies.

This category lists 13 detection rules.

RuleCategoryTechniqueImpact (C/I/A)
GitHub Action Secret Access ActivityCollectionT1552 - Unsecured CredentialsC:3 / I:3 / A:1
GitHub App Installation Token Suspicious AccessCredential AccessT1528 - Steal Application Access TokenC:2 / I:2 / A:1
GitHub CODEOWNERS File ModificationDefense EvasionT1562.001 - Impair Defenses: Disable or Modify ToolsC:2 / I:3 / A:1
GitHub Dependabot Configuration PoisoningSupply Chain CompromiseT1195.002 - Supply Chain Compromise: Compromise Software Supply ChainC:2 / I:3 / A:1
GitHub Environment Protection Rule BypassDefense EvasionT1562.001 - Impair Defenses: Disable or Modify ToolsC:2 / I:3 / A:1
GitHub Mass Repository Cloning DetectionCollectionT1213 - Data from Information RepositoriesC:3 / I:2 / A:1
GitHub Organization Member to Owner Role EscalationPrivilege EscalationT1098 - Account ManipulationC:3 / I:3 / A:2
GitHub Repository Visibility Changed to PublicData ExfiltrationT1537 - Transfer Data to Cloud AccountC:3 / I:2 / A:1
GitHub Secret Scanning Alert DetectedCredential AccessT1552: Unsecured CredentialsC:3 / I:2 / A:1
GitHub Self-Hosted Runner Compromise DetectionSupply Chain CompromiseT1195.002 - Supply Chain Compromise: Compromise Software Supply ChainC:3 / I:3 / A:2
GitHub Sensitive Data Commit DetectionCollectionT1074 - Data StagedC:3 / I:2 / A:1
GitHub Workflow Modifications DetectedInitial AccessT1195.001 - Supply Chain Compromise: Compromise Software Dependencies and Development ToolsC:3 / I:3 / A:2
GitHub Workflow pull_request_target InjectionSupply Chain CompromiseT1195.001 - Supply Chain Compromise: Compromise Software Dependencies and Development ToolsC:3 / I:3 / A:1

Rule Example

Below is an example of a rule definition for GitHub Action Secret Access Activity (view in repository):

# Rule version v1.0.0

dataTypes:
  - github
name: GitHub Action Secret Access Activity
impact:
  confidentiality: 3
  integrity: 3
  availability: 1
category: Collection
technique: "T1552 - Unsecured Credentials"
adversary: origin
references:
  - https://docs.github.com/en/actions/security-guides/encrypted-secrets
  - https://attack.mitre.org/techniques/T1552/
description: |
  Detects access, modification, or suspicious activities related to GitHub Action secrets. This could indicate attempts to steal credentials, API keys, or other sensitive information stored in repository or organization secrets.
  
  Next Steps:
  1. Review the GitHub audit logs to identify who accessed or modified the secrets
  2. Check if the user performing the action has legitimate business need for secret access
  3. Verify if any secrets were exposed in workflow logs or outputs
  4. Rotate any potentially compromised secrets immediately
  5. Review repository and organization permissions to ensure proper access controls
  6. Check for any unusual API calls or automated scripts accessing secrets
  7. Enable secret scanning alerts if not already configured
  8. Consider implementing additional controls like environment-specific secrets and approval workflows
where: |
  oneOf("log.action", ["secret.create", "secret.update", "secret.remove"]) ||
  oneOf("log.action", ["actions.secret.create", "actions.secret.update", "actions.secret.remove", "dependabot.secret.create", "dependabot.secret.update", "dependabot.secret.remove"])
afterEvents:
  - indexPattern: v1-7-22-log-github-*
    with:
      - field: log.repositoryName
        operator: filter_term
        value: '{{.log.repositoryName}}'
      - field: log.action
        operator: filter_match
        value: secret
    within: now-1h
    count: 3
groupBy:
  - lastEvent.log.action
  - lastEvent.log.repositoryName
  - lastEvent.log.senderLogin

Rule Details

GitHub Action Secret Access Activity

Identifies access, changes, or suspicious behavior involving GitHub Action secrets. This may point to efforts to steal credentials, API keys, or other sensitive data kept in repository or organization secrets.

GitHub App Installation Token Suspicious Access

Identifies suspicious GitHub App installation and token activity originating from unexpected sources. Attackers who obtain GitHub App private keys can create installation tokens for any organization with the app installed, gaining wide access to repositories.

GitHub CODEOWNERS File Modification

Identifies changes to CODEOWNERS files, which set required reviewers for code changes. Attackers might alter CODEOWNERS to eliminate review requirements for sensitive paths, allowing them to merge malicious code without appropriate review.

GitHub Dependabot Configuration Poisoning

Identifies changes to dependabot.yml configuration files that could point dependency updates to malicious registries or add malicious packages. Attackers might alter the Dependabot configuration to replace legitimate dependencies with malicious ones.

GitHub Environment Protection Rule Bypass

Identifies changes to GitHub environment protection rules, such as removing required reviewers, wait timers, or branch restrictions. Attackers might alter these protections to deploy malicious code to production environments without approval.

GitHub Mass Repository Cloning Detection

Identifies when several repositories are cloned or accessed within a brief time frame, which may signal data exfiltration or reconnaissance. This rule watches for repository access patterns that go beyond normal user behavior, possibly indicating an insider threat or a compromised account trying to steal source code.

GitHub Organization Member to Owner Role Escalation

Identifies privilege escalation of GitHub organization member roles from member to owner. Organization owners possess full administrative access, including managing billing, teams, repositories, and security settings. Unauthorized role escalation can result in total organizational compromise.

GitHub Repository Visibility Changed to Public

Identifies when a private repository's visibility is changed to public, which may expose proprietary source code, credentials, and sensitive configuration. This is a critical event that can result in data exposure and intellectual property theft.

GitHub Secret Scanning Alert Detected

Identifies when GitHub's secret scanning feature finds possible secrets, API keys, or credentials committed to a repository. This may indicate accidental exposure of sensitive information that attackers could exploit.

GitHub Self-Hosted Runner Compromise Detection

Identifies suspicious self-hosted runner operations, such as unexpected runner registration, deregistration, or workflows that specifically target self-hosted runners. Compromised self-hosted runners can grant access to the internal network and secrets stored on the runner machine.

GitHub Sensitive Data Commit Detection

Identifies commits that may hold sensitive data, including API keys, passwords, private keys, or other credentials, based on commit message patterns or file names.

GitHub Workflow Modifications Detected

Identifies changes to GitHub Actions workflows that could be used to insert malicious code into the CI/CD pipeline or steal secrets. Attackers might alter workflows to run arbitrary code, exfiltrate secrets, or compromise the software supply chain.

GitHub Workflow pull_request_target Injection

Identifies alterations to GitHub Actions workflow files that could enable abuse of the pull_request_target trigger. Even on forked PRs, this trigger runs with repository write permissions and access to secrets, making it a high-value target for supply chain attacks.