Skip to content
RCE Advisory Intermediate

GHSL-2020-332: Arbitrary code execution in a2o/snoopy workflow

A GitHub workflow triggered by pull requests from forks checked out and ran the fork's own code while holding a read/write token for the base repository and access to secrets. An attacker could therefore push changes to the base repository or exfiltrate secrets by opening a pull request.

jarlob Follow

Originally disclosed on GitHub Security Lab

The code-qa-sonarcloud.yml GitHub workflow is vulnerable to unauthorized modification of the base repository or secrets exfiltration from a Pull Request.

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

Impact

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

What the attacker needed

Ability to open a pull request from a fork

The fix

The issue was resolved, though the text does not describe the change; generally such workflows should not check out or run fork code under pull_request_target.

How it was found

  1. Open a pull request from a fork against the master branch.
  2. The pull_request_target workflow triggers and checks out the fork's head commit.
  3. The workflow runs the install script from the fork's code.
  4. The attacker's code uses the token and secrets to modify the base repository or steal secrets.

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.

GitHub Actions are automated jobs that run when something happens in a repository, such as a pull request. A special trigger called pull_request_target runs with powerful permissions and secrets, so it must never run code sent by an outsider. Here the job deliberately downloaded and executed the pull request author's code, letting that outsider act with the project's own privileges.

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.