Skip to content
RCE Advisory Intermediate

GHSL-2021-033: Arbitrary code execution in GitHub workflows of game-ci

GitHub workflows triggered by pull_request_target checked out and ran code from a fork, giving untrusted code access to the base repository's write token and secrets. An attacker could modify the base repository and exfiltrate secrets.

jarlob Follow

Originally disclosed on GitHub Security Lab

The main.yml, kubernetes-tests.yml, test.yml and build-tests.yml GitHub workflows are vulnerable to arbitrary code execution.

jarlob, on GitHub Security Lab

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

The workflow used pull_request_target (which grants write token and secrets) and then explicitly checked out and executed code from the untrusted fork.

Impact

The vulnerability allows for unauthorized modification of the base repository and secrets exfiltration.

What the attacker needed

Pull_request_target workflow; attacker can fork repository

The fix

The issue was fixed by the maintainers.

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.

When a GitHub Actions workflow runs on a pull request from a fork, it normally gets limited permissions. But if the workflow uses the pull_request_target event, it runs with the base repository's full permissions and secrets. Here, the workflow then checked out and ran code from the fork, so the attacker's code could use those permissions to change the repository or steal secrets.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by jarlob

View all

192 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.