← NIST SP 800-204D
5.1.2
Secure pull-push operations on repositories
Who and what may pull from or push to a repository, and the checks a change goes through on the way in. This is where pull request triggers and repository write access land.
Summary in ghtier's words. Read NIST 800-204D's own text
Incidents (8)
Last 12 months (5): ChainDrop: a hijacked maintainer account publishes through trusted publishing, Megalodon: mass backdooring of CI workflows, prt-scan: automated pull_request_target attacks, Clinejection: prompt injection in an AI issue triage workflow, hackerbot-claw autonomous agent RCE
2026
- ChainDrop: a hijacked maintainer account publishes through trusted publishing August 2026
- Megalodon: mass backdooring of CI workflows May 2026
- prt-scan: automated pull_request_target attacks March 2026
- Clinejection: prompt injection in an AI issue triage workflow February 2026
- hackerbot-claw autonomous agent RCE February 2026
2025
- GhostAction September 2025
- Nx "s1ngularity" August 2025
2021
Attack path techniques used
- Push directly, without review (Submit malicious code)
- Delete branches and workflow runs (Delete code or cover tracks)
- Push a release tag to an unreviewed commit (Point a release tag at a bad commit)
- Add a workflow that dumps secrets (Steal CI secrets and tokens)
- Run PR code in a privileged workflow (Steal CI secrets and tokens)
- Read secrets from the runner (Steal CI secrets and tokens)
- Prompt an AI step in a workflow (Steal CI secrets and tokens)
- Search the repository and its history for keys (Steal CI secrets and tokens)
- Post stolen data to a new public repository (Steal CI secrets and tokens)
- Poison a shared Actions cache (Poison the build or published package)
- Trigger the publish workflow from a tampered branch (Poison the build or published package)
- Publish a malicious version with a stolen token (Poison the build or published package)
- Release through the project's own pipeline (Poison the build or published package)
- Flip private repos to public (Read or expose private code)
- Leave a dormant workflow behind (Keep access)
- Plant editor or agent config that runs on open (Keep access)
Checklist items
The fixes for those techniques.
- Branch protection on default/release branches: required reviews of the last push + required status checks
- Rulesets applied: push restriction, tag protection, sensitive file-path protection
- Require the committer to match the pusher on sensitive repos
- Enable audit logging and export it to a SIEM for retention and detection
- CODEOWNERS in place, required on sensitive paths
- Inventory every Actions secret and its visibility/scope; the results are usually surprising
- Cloud credentials migrated from static keys to OIDC federation, scoped to repo + branch
- Put production secrets in environments with required reviewers
- Audit every use of pull_request_target and remove or restructure risky ones
- Set the default GITHUB_TOKEN permission to read-only at the org level
- Require approval for first-time/external contributor workflow runs on forks
- Limit who and what can trigger workflows with workflow execution protections
- Third-party Actions pinned to a full commit SHA instead of a mutable tag or branch
- Restrict which Actions can run to GitHub-verified creators or an internal allow-list
- Limit where workflow jobs can connect to, starting with release and deploy jobs
- Set `persist-credentials: false` on actions/checkout wherever later steps do not push
- Decide which AI coding agents and MCP servers may work on the organization's repositories
- Do not restore Actions caches in release and publish workflows
- Secret scanning and push protection enabled
- Write and rehearse a credential-rotation runbook before you need it
- Set an organization-wide maximum PAT lifetime (90 days is a reasonable default)
- Disable classic PATs organization-wide, forcing migration to fine-grained PATs
- Migrate to SAML SSO / Enterprise Managed Users for centralized identity control
- Adopt artifact attestations for build provenance on published binaries/images
- Publish packages with trusted publishing (OIDC) instead of long-lived registry tokens
- Make releases immutable, or protect release tags with a tag ruleset
- Restrict public repo creation, visibility changes, repo deletion, private forks and outside collaborator invites to owners
- Limit the number of organization owners to the minimum needed
Permissions involved
The GitHub permissions those incidents abused.