Skip to content
RCE Advisory Intermediate

GHSL-2024-163: GitHub's workflow unit-tests.yml is vulnerable to arbitrary code execution

The unit-tests.yml workflow could be triggered by a pull request that modifies the crowdin.yml workflow, causing it to check out and run untrusted code from the PR. An attacker could then execute arbitrary commands with full write permissions, potentially taking over the repository.

Alvaro Muñoz Follow

Originally disclosed on GitHub Security Lab

The unit-tests.yml GitHub’s workflow is vulnerable to arbitrary code execution.

pwntester, 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

Likely the unit-tests workflow was triggered by another workflow that could be modified via pull request, and it checked out and executed untrusted code with full write permissions.

Impact

The issue may lead to repository takeover.

What the attacker needed

Ability to open a pull request

How it was found

  1. Create a pull request that changes the crowdin.yml workflow to trigger on pull_request.
  2. In the same pull request, modify the package.json scripts to replace the test script with a malicious command.
  3. The unit-tests workflow runs, checks out the pull request code, and executes the malicious test script with full write permissions.

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 on GitHub when certain events happen, like a push or a pull request. Here, a workflow that runs tests could be tricked into running code from an attacker's pull request, and because it had write access to the repository, the attacker could take over the repository.

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 Alvaro Muñoz

View all

132 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.