Workflows: Write
Why Tier 1
Lets Contents: write also change files under .github/workflows; it does nothing on its own. A workflow pushed to a new branch with a push trigger runs at once, with the repository's secrets and the token permissions it sets, so the pair is a direct path to secrets and cloud access. Secrets in an environment with required reviewers stay out of reach.
Data plane permissions start at Tier 2. This one is raised for the reason above.
Can reach T0 when a secret the repository's workflows can read is an organization-wide credential, such as an owner's classic PAT or a GitHub App private key.
Documented: GitHub Docs: secure use, GitHub Docs: events that trigger workflows
- Target
- Repository
- Plane
- DataWorkflows: Workflow files and runs, variables, deployments, environments and Pages.
- Granted by
- Fine-grained PAT, GitHub App
- Available on
- Every setup
What it unlocks
6 REST endpoints need this permission, from GitHub's docs data. Some also need another permission, and a few work with only one kind of token.
- PUT /repos/{owner}/{repo}/contents/{path}also needs Contents: Write
- DELETE /repos/{owner}/{repo}/contents/{path}also needs Contents: Write
- POST /repos/{owner}/{repo}/git/refsalso needs Contents: Write
- PATCH /repos/{owner}/{repo}/git/refs/{ref}also needs Contents: Write
- POST /repos/{owner}/{repo}/releasesalso needs Contents: Write
- PATCH /repos/{owner}/{repo}/releases/{release_id}also needs Contents: Write
Roles that include it
- T0OwnerThe organization and every repository in it
- T0All-repository adminEvery repository in the organization
- T1WriteOne repository
- T1MaintainOne repository
- T1AdminOne repository
- T1Collaborator on a personal repositoryOne repository owned by a personal account
- T1All-repository writeEvery repository in the organization
- T1All-repository maintainEvery repository in the organization
Classic scopes that reach it
- T1workflowdocumented
Attack paths
Techniques it enables
- Have a workflow approve the PR Submit malicious code
- Add a workflow that dumps secrets Steal CI secrets and tokens
- Leave a dormant workflow behind Keep access
Escalations it starts
- Change a workflow, get its secrets: Every secret the repository's workflows can read, and cloud access through OIDC.
- Sign provenance for your own artifact: A forged artifact that passes provenance checks, wherever consumers verify with gh attestation verify --owner or --repo alone.
- Change a shared reusable workflow: Code running in every calling repository's workflow, with the secrets and GITHUB_TOKEN those runs get: an internal version of a compromised Action.
Reached through
- Add yourself to a team with repository access · from The Team maintainer role on a team with repository access
- Claim the old name of a renamed Action · from An Action or reusable workflow whose owner renamed or deleted their account or repository
Abused in
Fixed or limited by
- Enable audit logging and export it to a SIEM for retention and detection
- Branch protection on default/release branches: required reviews of the last push + required status checks
- CODEOWNERS in place, required on sensitive paths
- Rulesets applied: push restriction, tag protection, sensitive file-path protection
- Set the default GITHUB_TOKEN permission to read-only at the org level
- Turn off "Allow GitHub Actions to create and approve pull requests"
- 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