GHSL-2024-148_GHSL-2024-149: Code Injection and Execution of Untrusted Code in Astro's Actions workflows
The Astro repository's benchmark workflow allowed code injection through a comment command and execution of untrusted pull request code, enabling an attacker to steal a Vercel token and poison the build cache.
Originally disclosed on GitHub Security Lab
Astro contains Actions workflows that are vulnerable to Code Injection and Execution of Untrusted Code which could be leverage to steal secrets and poison the cache.
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the workflow inserted untrusted comment text directly into a shell command and also ran package installation on untrusted pull request code without isolation.
Impact
This could leak the TURBO_TOKEN secret and allow cache poisoning, potentially affecting other workflows.
What the attacker needed
A GitHub account; ability to open a pull request; comment on the pull request
The fix
The workflow was fixed by restricting the benchmark command to allowed characters.
How it was found
- Create a pull request in the Astro organisation.
- Add a comment containing the magic word and a command to the pull request.
- The workflow runs the command on the runner, which contacts the attacker's server.
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 report has not been written yet. The Original tab links to the source.
A GitHub Actions workflow is an automated script that runs when something happens on GitHub, like a new comment. Here, a comment containing a special word could make the workflow run a command chosen by the commenter, and a pull request could include code that runs automatically. This let an outsider run their own commands on the project's build system and potentially steal a secret token.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.