These write-ups are not threat intelligence and are not kept up to date as an incident develops. They are here to show how each attack worked, so you can find and fix the same techniques in your own setup. For the latest on an incident, read its sources.
ArtiPACKED artifact token leakage
August 2024 · Ongoing
Public workflow artifacts in projects of Red Hat, Google, AWS, Microsoft, OWASP and others contained the job's own GitHub token, and Unit 42 showed it could download one and push with it before the job ended, or use a six-hour runtime token to swap an artifact.
- Way in
- Leaked token
- Access held
- T2Contents: WriteReplace the run's artifacts
Full summary
actions/checkout writes the workflow's GITHUB_TOKEN into the local git configuration by default so later steps can run git commands. Workflows that uploaded their whole checkout directory as an artifact, or uploaded super-linter's log with CREATE_LOG_FILE on, published that token with the artifact, readable by anyone on a public repository. Unit 42's Yaron Avital found such artifacts in well-known projects of Red Hat, Google, AWS, Canonical, Microsoft and OWASP, among others. A GITHUB_TOKEN expires when its job ends, so most were already dead by the time they could be downloaded. But upload-artifact v4 makes an artifact downloadable while the job is still running, and where steps followed the upload there was a race to win: Avital took a token from Red Hat's clair project and used it to create a branch before it expired. Some artifacts also held ACTIONS_RUNTIME_TOKEN, which lives about six hours and can replace a run's artifacts, so a later job or a user downloading them gets the attacker's file. super-linter stopped writing environment variables to its log after the report.
How it unfolded
Pick a step to zoom into it. A dashed line is a step the sources do not state. Blue dots are the checklist items that break the step.
Whole path
The whole attack, one row per step. Pick a step on the left, or click a box in its row.
By default actions/checkout persists credentials: it writes the workflow's GITHUB_TOKEN into the repository's local git configuration so later steps can push. Nothing removes it before the job ends.
Workflows that uploaded their whole checkout directory as an artifact took that file with them; microsoft/typescript-bot-test-triggerer was one. super-linter with CREATE_LOG_FILE set wrote environment variables, tokens among them, to a log that many workflows upload. On a public repository anyone can download the artifact.
What breaks this step
- 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
- Set the default GITHUB_TOKEN permission to read-only at the org level
- 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
- Keep logs that print environment variables out of uploaded artifacts: super-linter's log carried the token.
A GITHUB_TOKEN expires when its job ends, and Unit 42's first tries all failed with 401. upload-artifact v4 makes an artifact available while the job is still running, so where other steps followed the upload there was time to download it, extract the token and use it. In Red Hat's clair project the token was used to create a branch named impala before it expired.
Some artifacts also contained ACTIONS_RUNTIME_TOKEN, an undocumented token that actions/cache and actions/upload-artifact use, valid for about six hours. Unit 42 used one to replace a project's artifact with its own file, so whatever downloads that artifact next gets the attacker's version.
What breaks this step
- Set an organization-wide maximum PAT lifetime (90 days is a reasonable default)
- Disable classic PATs organization-wide, forcing migration to fine-grained PATs
- Secret scanning and push protection enabled
- Set `persist-credentials: false` on actions/checkout wherever later steps do not push
- Require organization owner approval for fine-grained PATs.
- Never upload the checkout workspace as an artifact.
Unit 42 reported the findings to the affected projects, including Red Hat, Google, AWS, Canonical, Microsoft and OWASP, and to super-linter, which stopped printing environment variables to its log file. Unit 42 published in August 2024.
Frameworks
Ongoing. First seen August 2024. Mapping by ghtier, not yet reviewed. Threat landscape
Sources
- researchArtiPACKED: hacking giants through a race condition in Actions artifacts
- trackerGitHub Actions artifacts found leaking auth tokens in popular projects
- researchGitHub Actions security: a guide to common risks
- researchGitHub Actions hardening
Reported by: Unit42