The GitHub Actions Worm: Compromising GitHub Repositories Through the Actions Dependency Tree
A GitHub Actions worm can spread through the dependency tree of actions: once an attacker compromises one action repository, they can use secrets from a consuming workflow to push malicious code to branches or overwrite tags of dependent action repositories, recursively infecting more repositories. The authors demonstrated this by repojacking an abandoned action repository and showing how it could infect a popular project and its dependents.
Published on paloaltonetworks.com
By Asi Greenholts
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the root cause is that GitHub Actions workflows grant write permissions and expose secrets to third-party actions, and actions can be referenced by mutable tags or branches, allowing a compromised action to modify its dependents.
Impact
A successful worm could steal secrets, modify source code, and spread to many public and private repositories, potentially affecting thousands of dependents and downstream package consumers.
What the attacker needed
Compromise of an initial action repository; workflow uses the compromised action; token has write permissions; branch/tag protection absent or bypassable
The fix
The issues were fixed by replacing the vulnerable action with custom bash commands and deleting all workflow files, and generally should be mitigated by least-privilege tokens, branch and tag protection, network monitoring, and pinning actions to commit hashes.
How it was found
- Compromise an initial action repository using an attack vector such as repojacking.
- When a workflow uses the compromised action, dump the runner's memory to obtain secrets including GITHUB_TOKEN.
- Use the token to push malicious code to a branch or overwrite a tag in a dependent action repository.
- Repeat recursively as dependent workflows run, infecting further repositories.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
GitHub Actions are automated tasks that run when code is pushed or other events happen. Actions often use other actions, forming a chain of dependencies. If an attacker takes over one action in that chain, they can use the permissions and secrets available in the workflows that use it to modify other actions, spreading like a worm.