How it works
A uses: line pulls someone else's code into a job. An action runs with access to its job's context and workspace. GitHub's own guidance states the consequence: a compromised action can access all the repository's secrets available to the job and may use the GITHUB_TOKEN to write to the repository.
The reference decides who controls that code. owner/action@v4 and owner/action@main are resolved each time a job starts, so the commit behind them can change between two runs of an unchanged workflow. Only a full-length commit SHA names fixed content.
The ways in, from the action's side:
- Moved tag. An attacker with write access to the action's repository points existing version tags at a malicious commit. In the
tj-actions/changed-filescompromise (CVE-2025-30066) attackers retroactively modified multiple version tags to reference one malicious commit, which extracted secrets from the runner process memory and wrote them into the workflow logs. - Compromised dependency of the action. Actions call other actions and bundle or download packages. Compromising one of those reaches every action built on it.
- Runtime download. A SHA-pinned action can still fetch a tool by version, pull a container image by tag, or pipe an install script from a URL. Whoever controls that file controls the step.
- Impostor commit. A SHA that exists only in a fork still resolves under the parent repository's name. A workflow "pinned" to such a SHA runs code that the action's maintainers never merged.
- Typosquatted action. A repository whose name is one character away from a popular action waits for a typing mistake.
- Reusable workflow. A called workflow is a separately resolved definition, referenced by SHA, tag or branch. It receives
github.tokenautomatically, and withsecrets: inheritit receives the caller's secrets. A changed reusable workflow changes every caller's pipeline.
Prerequisites
- Control over code that victims reference: write access to an action's or reusable workflow's repository (most often through a stolen maintainer token, see personal access token theft and abuse), a successful attack on that repository's own workflows, or control of a download location the action uses.
- Consumers that reference the code by a mutable ref, or that allow runtime downloads without verification.
- From the consumer's side, nothing has to be misconfigured beyond the unpinned reference. The job's normal token and secrets are the prize.
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
1. Map who uses what
For one target organization, list the actions its workflows reference and how they are pinned:
# On a clone: every uses reference, most frequent first
grep -rhoE "uses: *[^ #]+" .github/workflows/ | sort | uniq -c | sort -rn
# unpinned-uses flags references that are not pinned by SHA;
# impostor-commit, ref-confusion and known-vulnerable-actions need online mode
zizmor --gh-token $(gh auth token) octo-org/octo-repo
Gato-X does the same at scale and follows reusable actions into their own repositories:
export GH_TOKEN=<personal access token>
gato-x e -R repositories.txt -oJ results.json
An attacker choosing a target action looks for the opposite view: an action with many consumers, few maintainers and a weak workflow of its own.
2. See what a tag points to
# Current commit behind each tag of an action
git ls-remote --tags https://github.com/octo-org/setup-tool
The same command, saved over time, is the defender's record of when a tag moved.
3. Move the tag
With write access to the action's repository, the attacker adds a commit with the payload and repoints the tags that consumers use:
git tag -f v4 <malicious commit SHA>
git push --force origin v4
No consumer sees a change in their own repository. Their next run resolves @v4 to the new commit.
4. Run in the consumers' jobs
The payload runs as a step in each job that uses the action. It can read the token through github.token, read secrets passed to any step from the runner's memory, request an OIDC assertion where id-token: write is set, and alter the build output. In the tj-actions case the payload printed the secrets to the log, base64-encoded twice, so that it needed no outbound connection:
# Decoding a value recovered from a workflow log
echo 'xxx' | base64 -d | base64 -d
5. The reusable workflow variant
A caller like this hands its secrets to whatever main is at the time of the run:
jobs:
release:
uses: octo-org/shared-workflows/.github/workflows/release.yml@main
secrets: inherit
Write access to octo-org/shared-workflows is then write access to every calling repository's release job.
Impact
One compromised action is a compromise of every pipeline that runs it. The attacker collects tokens, registry credentials and cloud keys from many organizations at once (credential theft at supply chain scale) and can change what those pipelines build and publish, which passes the compromise on to their users. See GITHUB_TOKEN and installation token abuse for what the stolen token allows.
OPSEC and artifacts
- Restoring the tags. After a collection window the attacker moves the tags back. Consumers' job logs from the window still record the commit that each
usesreference resolved to, as long as the logs are retained. - Commit off the main line. A payload commit that no branch contains does not show up when someone reads the default branch's history. It still exists by SHA, and anyone who recorded
git ls-remoteoutput over time can see when the tag moved to it. - No network traffic. Printing secrets to the log avoids outbound connections that egress monitoring would catch. The encoded values stay in the log, readable by anyone who can read the run, until the log is deleted.
- Consumer side records. Each affected run has its run and job records and the audit actions
workflows.created_workflow_run,workflows.prepared_workflow_jobandworkflows.completed_workflow_run. None of them names the action's commit; only the job log does. - Second stage. Use of the collected credentials appears in other logs: registry publishes, cloud sign-ins, and writes by personal access tokens found in secrets.
Detection
- Resolved commit against an approved list. Parse the setup section of job logs for the commit each action resolved to and compare it with the SHA you reviewed. A known tag that resolves to a new commit is the primary signal.
- Tag movement on the actions you depend on. Record
git ls-remote --tagsfor each third-party action on a schedule and alert on a changed SHA for an existing tag. - Static findings. zizmor reports
unpinned-uses,impostor-commit,ref-confusion,known-vulnerable-actions,secrets-inheritandunpinned-images. Run it in CI and across the organization. - Unusual step behaviour. On self-hosted runners and with egress monitoring on hosted ones, look for an action step that reads another process's memory, spawns download tools or connects to a new domain. Double-encoded blobs in job logs are another sign.
- Guard rail changes. The allowed-actions policy and the SHA pinning requirement are changed through Actions settings, recorded as repo.update_actions_settings and org.update_actions_settings. The code scanning or Dependabot disabled rules alert when the tooling that reports vulnerable actions is switched off.
When an action you use is reported compromised, treat every secret that was available to a job that ran it during the window as exposed, and rotate. The Actions secret or variable changed rules help confirm the rotation and spot unexpected changes.
Mitigation
- Pin every action and reusable workflow to a full-length commit SHA, and check that the SHA belongs to the action's own repository and not to a fork. Keep the version as a comment on the same line so that Dependabot can propose updates.
- Enforce it. Restrict the organization to selected actions and require SHA pinning in the Actions policy:
gh api /orgs/octo-org/actions/permissions
# {"enabled_repositories":"all","allowed_actions":"selected","sha_pinning_required":true}
gh api /orgs/octo-org/actions/permissions/selected-actions
- Review updates before adopting them. Read the diff of the action between the old and the new SHA, including bundled code, composite steps and what it downloads.
- Constrain runtime downloads. Prefer actions that verify digests or signatures of what they fetch, pin container images by digest, and keep build provenance for external components.
- Pass secrets explicitly. Replace
secrets: inheritwith named secrets, and give each job a minimalpermissionsblock, following least privilege, so that a compromised step finds little. - Protect your own actions. If you publish actions or shared workflows, protect their tags and branches with rulesets, require review for changes, and replace long-lived maintainer tokens as described in the personal access token security guide.
Detection rules for this attack
Log events to collect
FAQ
Why is referencing an action by tag risky?
A tag is a movable pointer. Anyone with write access to the action's repository can move v4 to a different commit, and every workflow that says uses: owner/action@v4 runs the new code on its next run without any change in the consuming repository.
Does pinning an action to a commit SHA make it safe?
It fixes which code of that action runs. It does not cover what the action downloads at run time, such as a tool fetched by version or a container image pulled by tag, and it does not help if the SHA comes from a fork instead of the action's own repository.
What happened in the tj-actions/changed-files compromise?
In March 2025 attackers moved multiple version tags of the action to a malicious commit. The code read secrets from the runner process memory and printed them, encoded, into the build logs. Repositories with public logs exposed their secrets to anyone. More than 23,000 repositories used the action.
Can a reusable workflow get more permissions than its caller?
No. The GITHUB_TOKEN permissions passed from the caller can only be kept or reduced by the called workflow. But the called workflow receives the token automatically, and with secrets: inherit it also receives every secret the caller can use.
References
- Secure use reference: using third-party actions (GitHub Docs)
- Reusable workflows reference (GitHub Docs)
- Compromise Software Dependencies and Development Tools, T1195.001 (MITRE ATT&CK)
- tj-actions/changed-files compromise, CVE-2025-30066 (GitHub Advisory Database)
- REST API endpoints for GitHub Actions permissions (GitHub Docs)
- zizmor: audit rules (unpinned-uses, impostor-commit, known-vulnerable-actions)
Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.