Skip to content
RCE Advisory Intermediate

GHSL-2020-247: Unauthorized repository modification or secrets exfiltration in the GitHub workflow of redwoodjs/redwood

The GitHub workflow 'create_pr_package.yaml' used the pull_request_target event, which grants write access to the base repository and secrets, but then explicitly checked out and ran code from the pull request's fork. An attacker could open a pull request from a fork to execute arbitrary code in the workflow, leading to unauthorised repository modification or secrets exfiltration.

jarlob Follow

Originally disclosed on GitHub Security Lab

The ‘createprpackage.yaml’ GitHub workflow is 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

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 by the maintainers, likely by removing the explicit checkout of the pull request head or by not running untrusted code in a privileged context.

How it was found

  1. The workflow is triggered by a pull request from a fork.
  2. The workflow checks out the pull request's head commit.
  3. The workflow installs dependencies and runs the build script from the fork.
  4. The attacker's code executes with access to the base repository and 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.

A GitHub workflow is an automated script that runs when something happens, like a pull request. The 'pull_request_target' trigger gives the workflow powerful permissions, including access to secrets and the ability to write to the main repository. The mistake was that the workflow then downloaded and ran code from the pull request itself, which could be controlled by an attacker. So the attacker's code ran with those powerful permissions, letting them 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.