GitHub Actions Security
GitHub Actions runs repo-defined YAML with secrets, a
GITHUB_TOKEN, OIDC identity and often publish rights. The attack surface is untrusted event input, mutable third-party action refs, stolen tokens that can commit workflows, and runners/caches shared across trust levels.
How it works
Trust model (Wiz): a trusted zone (owners, collaborators, approved bots that can push to main, edit workflows and read secrets) and an untrusted zone that can still trigger workflows through fork PRs, issues, comments, discussions, forks and stars. An attacker gets in by one of three routes:
- Circumvention. Untrusted input steers a privileged workflow. See Pwn Requests and script injection below.
- Third-party component compromise. A tag of an action you
uses:is repointed. See tj-actions changed-files Compromise. - Promotion. Stolen PATs or maintainer accounts commit workflows directly. In GhostAction/Gheist (Oct 2026), anyone who could commit a workflow file got every secret.
Dangerous triggers: no write needed to fire them, and they run in the default-branch context with secrets and write access.
| Trigger | Attacker vector |
|---|---|
pull_request_target | PR content (head checkout, title, branch) |
issues, issue_comment | title / body / comment |
discussion, discussion_comment | discussion text |
fork, watch | attacker-triggered fork / star |
workflow_run | inherits poisoned artifacts from parent |
Techniques / payloads
Expression (script) injection
${{ }} is expanded before the shell parses the step:
- run: some-command ${{ github.event.issue.title }} # vulnerable
# github.head_ref variant: branch names can't contain spaces, so payloads use $(...) + ${IFS} (Ultralytics)
- env:
TITLE: ${{ github.event.issue.title }}
run: some-command "$TITLE" # safe: data, not codeAlso avoid writing attacker-influenced data to $GITHUB_ENV/$GITHUB_PATH, which lets an attacker set LD_PRELOAD or shadow binaries in later steps.
Mutable refs, tag repointing and imposter commits
@v4resolves at job start, so a force-pushed tag changes what runs. Cases: tj-actions (Mar 2025, all tags),trivy-action(Mar 2026, 76 of 77 tags force-pushed by TeamPCP, which cascaded into LiteLLM on PyPI), andactions-cool/issues-helper(2026, every tag moved to an imposter commit that only existed in a fork. It ran Bun, readRunner.Workermemory and exfiltrated tot.m-kosche[.]com, linking it to Mini Shai-Hulud).- A full SHA in
uses:doesn’t prove the commit belongs to the named repo, because fork-network commits resolve under the parent.
Secret extraction primitives
- Read
Runner.Workerprocess memory (/proc/<pid>/mem) to get every decrypted secret, including ones the step never referenced. - Log masking only matches verbatim values. Base64/base32/JSON-wrapped secrets print in clear (Gheist base32-encoded
toJson(secrets), downloaded the log by API, then deleted the run). permissions: {}restrictsGITHUB_TOKENbut not secrets.actions/checkoutpersists the token in.git/config(persist-credentials: true), and it can end up in uploaded artifacts. Gato’s artifact scanner hunts for these.- Caches: in Rust/Miri,
cargo miriwrote all env vars intotarget/. Cachingtarget/then exposed secrets to any PR that could read the cache.
Self-hosted runners
They’re non-ephemeral by default, so an attacker who runs code from a fork or PR on a public repo can persist and poison ~/.npm/~/.cache/pip for later release jobs. Gheist added a job that hunted for IMDS creds, Docker sockets and K8s tokens on self-hosted runners. Gato/Trajan enumerate self-hosted runner exposure from workflow files plus run logs.
Egress is open by default. GitHub’s 2026 security roadmap states hosted runners allow unrestricted outbound access; GhostAction’s injected workflow sent all repo secrets in one POST to a bare IP. A Nov 2026 survey of hosted runners, ARC 0.15.1, the Terraform AWS runner module, GARM, nine runner vendors, Harden-Runner and the GitLab/Buildkite/Jenkins/Tekton Kubernetes runners found none documenting default-deny egress (Namespace, Depot, Avrea and Harden-Runner offer it as an option; only Avrea documents blocking the metadata server). A Kata microVM isolates the kernel but the cloud metadata server still answers from inside the guest. Default-deny egress does not stop exfiltration through GitHub itself: the prt-scan campaign printed secrets into workflow logs and posted them as PR comments (karlkfi).
Forks can pick your runner. A pull_request run executes the merge commit, workflow file included, so a fork can edit runs-on to target any runner set the repo can reach; GitHub’s approval setting keys on the contributor, not the fork. GitHub’s fork flag read true on a same-repo PR inside a forked repo, so GitHub Actions Gateway (GAG) 2.0 compares head and base repository before minting a runner and refuses mismatches. pull_request_target runs the base repo’s workflow and is not refused; GitHub blocks it by default in public repos from 2 Dec 2026 (Pwn Requests). The hackerbot-claw bot spent ten days opening crafted PRs against weak workflows, exfiltrated a GITHUB_TOKEN and used another stolen token to delete a security scanner’s releases (karlkfi).
AI-powered actions
anthropics/claude-code-action(12K+ workflows) andopenai/codex-actiontrusted any actor ending in[bot](checkWritePermissions). Any GitHub App token, or an App registered under an allowed bot’s free name (“dangling GitHub Apps”), bypassed the write-access gate. Dependabot confused-deputy madedependabot[bot]thegithub.actoron attacker PRs. RyotaK’s chain reached OIDC tokens through prompt injection and could have backdooredclaude-code-actionitself (CVSS 7.8, exploited in the wild per Anthropic).- Models refuse to leak
secrets.*, but they will dump credential files that other steps create (google-github-actions/auth→gha-creds-*.json).show_full_output: true/gemini_debug: truewrite every tool read to the public log. - GitLost (Noma): an issue in a public repo steered a GitHub Agentic Workflow with org-wide read access into posting a private repo’s README as a comment. The word “Additionally” got past the guardrail.
- JetBrains Junie GitHub Action < 1.8.0: code execution with workflow credentials via fork updates (CVE-2026-123852).
See Indirect Prompt Injection, AI Coding Assistant Risks.
Defenses
permissions: {} # workflow default; grant per job
jobs:
build:
permissions:
contents: read
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false- Org settings: read-only default token (orgs created before Feb 2023 default to read-write). Use an allowed-actions list with SHA-pinning enforcement and
!org/actionblocking (Aug 2025). Disable “Allow GitHub Actions to create and approve pull requests”. - Pin + cooldown: pin full 40-char SHAs from the official repo and update through Dependabot/Renovate. A 7–14 day cooldown (
pinact --min-age 7, RenovateminimumReleaseAge) catches most compromises. Transitive composite actions and reusable workflows still float. - Lockfile (public preview 2026-10-14):
gh actions-lockwrites.github/workflows/actions.lockwith the commits of direct and transitive actions, reusable workflows,owner_id/repo_idand a requirement that the commit is on a source-repo branch. It’s enforced by the “Require lockfile” policy. It locks whatever you resolved, including malware if a tag was already poisoned.--accept-movedshould never be automated. Boost Security showed a hand-edited fork-only SHA passing--verify. - Secrets: don’t use
toJson(secrets)orsecrets: inherit. Put release credentials in Environments with required reviewers, or in GitHub Apps. Use OIDC to the cloud instead of long-lived keys.::add-mask::derived values, and never use structured blobs as secrets. 2026 roadmap: scoped secrets bound to workflow identity/branch, and write access no longer grants secret management. - Execution policy: Workflow Execution Protections (actor/event rulesets, evaluate mode). Since 2026-07-28, suspicious runs in public repos are held in
action_required. That hold doesn’t apply to private repos or GHES. - Runners: use ephemeral runners only. Never use self-hosted runners for public repos. Separate runner groups by trust level. Default-deny egress (Harden-Runner, GitHub native egress firewall, Actions Data Stream telemetry on the roadmap). For Kubernetes runners, GAG’s defaults are a reference: per-tenant default-deny NetworkPolicy allowing only cluster DNS and a tenant egress proxy to GitHub’s published ranges (admin-managed allowlist), metadata server blocked, fork jobs refused unless a runner set opts in, Pod Security
baseline(opt-inrestricted), GitHub App key kept out of worker pods, controllers off worker nodes, Kata for kernel isolation and unprivileged Docker builds (karlkfi). - Lint and enumerate:
zizmor(template injection, unpinned uses, dangerous triggers; full YAML-anchor support validated on 41,253 workflows), CodeQL for Actions, OpenSSF ScorecardDangerous-Workflow,gato/trajan/Gato-X for offensive enumeration, Allstar for policy. - Maintainers: enable Immutable Releases so tags and assets can’t be rewritten.
Related
- Software Supply Chain Security
- Pwn Requests
- tj-actions changed-files Compromise
- CI/CD Pipeline Attacks
- Shai-Hulud Worm
- SBOM and Provenance
- Prompt Injection · Indirect Prompt Injection · AI Coding Assistant Risks
- Secrets in Git History · Leaked Cloud Credentials
Sources
- Wiz — Primer on GitHub Actions Security · original
- Wiz — How to Harden GitHub Actions: An Updated Guide · original
- Wiz — The (In)security Landscape of AI-Powered GitHub Actions · original
- GitHub Docs — Security hardening for GitHub Actions · original
- GitHub — Actions 2026 Security Roadmap · original
- GitHub Actions Got a Lockfile on October 14 · original
- Pin your GitHub Actions by commit SHA and lock workflow permissions · original
- GhostAction and Gheist Stole CI/CD Secrets · original
- THN — actions-cool tags redirected to imposter commit · original
- Rust — GitHub Actions leaking secrets when Miri output is cached · original
- Trail of Bits — Hardening zizmor · original
- praetorian-inc/gato · original
- Claude Code GitHub Actions Flaw · original
- JetBrains Junie GitHub Action advisory · original
- Noma — GitLost · original
- Your CI Can Reach the Whole Internet. Why? · original