Skip to content
Pwnversity
AUD-GITHUBintermediate · 11 min · upd. 2026-11

Auditing GitHub

GitHubGitHub Actionszizmor

A GitHub organization holds the code, but also the workflows that build and deploy it, the secrets those workflows use and the permissions of every person, token and connected app. Whoever controls the organization controls everything that comes out of it. This card covers the specific settings reviewed in an audit. The general pipeline principles (OWASP CI/CD, SLSA, artifact signing) are in CI/CD security.

GitHub runs the platform and the hosted runners. The organization decides:

  • who joins and with which role;
  • which tokens and apps can access it;
  • how branches are protected;
  • what workflows can do and with which permissions;
  • which secret and dependency detection features are on.
flowchart TB
    M["Members and collaborators<br/>2FA, role"] --> O(("Organization"))
    T["PATs, OAuth apps,<br/>GitHub Apps, deploy keys"] --> O
    O --> R["Repositories<br/>branch rules, CODEOWNERS"]
    R --> W["Actions workflows<br/>GITHUB_TOKEN, secrets"]
    F["PR from a fork"] -->|"pull_request /<br/>pull_request_target"| W
    W --> E["Environments<br/>reviewers, deployment secrets"]
    E --> C["Cloud / production<br/>OIDC or keys"]
Setting What to look for Recommended value
Required 2FA Members or collaborators without 2FA, or with insecure methods On; check filter=2fa_disabled and 2fa_insecure
Base member permission Write or admin by default on every repo No permission or read, with access granted through teams
Owners Too many; unused personal accounts Two or three, with phishing-resistant 2FA
Repo creation, visibility changes, forking private repos Any member can make a repo public Limited to owners
Outside collaborators Write access to repos with secrets Periodic review; no access to critical repos
Inactive members Accounts with no activity in months Remove
Ventana de terminal
# Read-only with gh (read-only token on the organization)
gh api orgs/ORG --jq '{two_factor_requirement_enabled, default_repository_permission,
members_can_create_repositories, members_can_fork_private_repositories}'
gh api "orgs/ORG/members?filter=2fa_disabled" --jq '.[].login'
gh api orgs/ORG/outside_collaborators --jq '.[].login'
  • Personal access tokens. By default the organization accepts both classic and fine-grained tokens. Check:
    • whether classic tokens are restricted;
    • whether fine-grained tokens need an owner’s approval (only these support approval);
    • which maximum lifetime is enforced. For fine-grained tokens, the default maximum is 366 days.
  • Installed GitHub Apps and OAuth apps (gh api orgs/ORG/installations): permissions, the repos they reach and whether they’re still used.
  • Deploy keys with write access (gh api repos/ORG/REPO/keys): each one is a credential with no human owner.
  • Webhooks (gh api repos/ORG/REPO/hooks): URLs pointing to services that no longer exist, no secret or no TLS.

On the default branch and release branches, with rulesets or branch protection:

  • required review before merging, without the author approving their own change;
  • CODEOWNERS required on .github/workflows/;
  • required status checks;
  • no force push or branch deletion;
  • nobody bypasses the rules, not even admins, except a minimal, justified list.
Ventana de terminal
gh api repos/ORG/REPO/rulesets --jq '.[] | {name, enforcement}'
Setting (organization or repo) Recommended value Why
Default GITHUB_TOKEN permissions Read-only (default_workflow_permissions: read) Each workflow requests what it needs with permissions:
Actions can create and approve PRs Off (can_approve_pull_request_reviews: false) A compromised workflow can’t approve itself
Allowed actions GitHub’s own, verified creators or an explicit list Block compromised versions with !
Require full-SHA pinning On (sha_pinning_required) Tags can be moved
Dependency lockfile .github/workflows/actions.lock and the Require lockfile policy Also pins transitive actions
Approval for fork workflows For all outside collaborators No stranger runs code on your runners
Self-hosted runners Never on public repos; ephemeral A PR could run code inside your network
Ventana de terminal
gh api orgs/ORG/actions/permissions --jq '{allowed_actions, sha_pinning_required}'
gh api orgs/ORG/actions/permissions/workflow
gh api orgs/ORG/actions/runners --jq '.runners[] | {name, os, labels: [.labels[].name]}'

Organizations created since February 2023 start with a read-only token, unless they inherit a different value from their enterprise. Older ones keep the permissive value until someone changes it, so always check it in an older organization.

pull_request_target runs the workflow from the default branch, with the repository’s secrets and a write token, even when the PR comes from a fork. If that workflow fetches and runs the PR’s code, the attacker runs their code with those privileges (a pwn request). GitHub has been closing this in phases:

Date Change
Dec 8, 2025 The pull_request_target workflow and checkout always come from the default branch, not the PR’s base branch
Jun 18, 2026 actions/checkout v7 refuses to fetch fork code in pull_request_target and in workflow_run triggered by PRs. Turned off with allow-unsafe-pr-checkout
Jul 20, 2026 The same protection reaches supported major versions, but only those referenced by a floating tag (@v4). Those pinned to a SHA or exact version don’t get it
Dec 2, 2026 pull_request_target is blocked by default in public repos unless an Actions event policy allows it. Private and internal repos aren’t affected

zizmor (1.32.0) is a static analyzer for workflows. In --offline mode it needs no token. The lab’s vulnerable workflow combines:

  • pull_request_target checking out the PR’s SHA;
  • permissions: write-all;
  • actions pinned by tag (including tj-actions/changed-files@v45);
  • an issue title interpolated into run:.
Ventana de terminal
zizmor --offline mal/
warning[artipacked]: credential persistence through GitHub Actions artifacts ci.yml:11
error[excessive-permissions]: overly broad permissions ci.yml:6
error[dangerous-triggers]: use of fundamentally insecure workflow trigger ci.yml:3
error[template-injection]: code injection via template expansion ci.yml:23
error[unpinned-uses]: unpinned action reference ci.yml:11
error[unpinned-uses]: unpinned action reference ci.yml:14
10 findings (4 suppressed, 2 unsafe fixes): 0 informational, 0 low, 1 medium, 5 high

The fixed version changes five things:

  1. It uses pull_request instead of pull_request_target.
  2. It sets a global permissions: {} and only contents: read on the job that needs it.
  3. It pins actions by full SHA.
  4. It sets persist-credentials: false on the checkout.
  5. It passes the title through an environment variable (env: TITLE: ${{ ... }} and "${TITLE}" in the script).

With that, zizmor reports no findings. The audits that need the API (actions with known vulnerabilities, impostor commits) require a token and weren’t run in the lab.

  • Secret scanning and push protection on every repo. Push protection blocks the commit before the secret reaches history.
  • Dependabot (alerts and updates, including for workflow actions) and code scanning.
  • Environment secrets, with required reviewers and allowed branches on production environments, instead of repository secrets any workflow can see.
  • OIDC to the cloud instead of fixed keys (see CI/CD).
  • Open alerts reviewed: gh api repos/ORG/REPO/secret-scanning/alerts --jq '.[] | {secret_type, state}'.
  • tj-actions/changed-files (March 2025, CVE-2025-30066).

    1. An attacker compromised the action, used in thousands of repositories, and moved most of its version tags to a malicious commit.
    2. That commit dumped the runner’s secrets into the workflow log, which is public in public repositories. Public-repo runs between March 12 and 15 are considered high risk.
    3. According to Wiz, the likely origin was another compromised action, reviewdog/action-setup@v1. It ran in the project’s own CI, in a workflow that used a personal token with permissions on the repository.

    CISA added it to the KEV catalog on March 18. Pinning by SHA would have prevented the silent change; the ! block policy lets you cut off a specific version across the organization.

  • Pwn requests as a class. GitHub spent 2026 changing pull_request_target defaults because it’s the most repeated way of stealing secrets from open projects. The changes reduce the typical case, but not the variants in the warning above.

  • 2FA required; no members with 2fa_disabled or 2fa_insecure
  • Minimal base permission; few owners; repo creation and visibility changes limited
  • Outside collaborators and inactive members reviewed
  • Classic tokens restricted; fine-grained tokens with approval and a maximum lifetime
  • GitHub Apps, OAuth apps, deploy keys and webhooks inventoried
  • Default branch protected: review, CODEOWNERS on workflows, checks, no force push or broad exceptions
  • GITHUB_TOKEN read-only; Actions not allowed to approve PRs
  • Allowed actions limited; SHA pinning required or lockfile mandatory
  • Fork workflows need approval; no self-hosted runners on public repos
  • No pull_request_target that runs PR code; no template injection
  • zizmor (or equivalent) in CI on .github/workflows/
  • Secret scanning with push protection, Dependabot and code scanning on
  • Production secrets in environments with reviewers; OIDC to the cloud