Skip to content
RCE Disclosed report Intermediate

Github base action takeover which is used in `github.com/Shopify/unity-buy-sdk`

A GitHub Actions workflow in a Shopify repository referenced a base action from a GitHub account that had been renamed, leaving the old username available for registration. An attacker could register that username and host a malicious action, which would then run with Shopify's credentials when a pull request triggers the workflow.

codermak Follow

Originally disclosed on HackerOne

  • Triaged in 8 days
  • Fixed in 54 days
  • Paid in 16 days
  • Disclosed after 6 months

Summary:

Shopify have a github repository https://github.com/Shopify/unity-buy-sdk In the repository there is a github action, which is used a base action from an external github repository. That github account as not registered on github.com So I was able to takeover the account and host PoC.

Shops Used to Test:

NA

Relevant Request IDs:

NA

Steps To Reproduce:

  1. Go to https://github.com/Shopify/unity-buy-sdk/blob/master/.github/workflows/build.yml#L71
  2. You will see this github repository MirrorNG/unity-runner getting used as base action at line 71
  3. Try accessing the github repository https://github.com/MirrorNG/unity-runner you will be redirected to https://github.com/MirageNet/unity-runner
  4. This happens when github organization name or username is renamed, github redirects all the old urls to new github account
  5. But with this, the old github username becomes available for anyone to register and when someones registers it the redirection will stop and all links will open newly created repositories.
  6. Try accessing the github organization https://github.com/MirrorNG you will see takeover message

Note: I haven't taken over the repository, so as to avoid breaking the existing action as its getting used.

Supporting Material:

Screenshot_from_2022-01-02_16-40-54.png
Screenshot_from_2022-01-02_16-40-54.png From the original on HackerOne

Reference

https://hackerone.com/reports/1087489

Impact

An attacker can takeover the github account and host malicious action on it, when any any pull request is sent on the repository, it will end up running the action and you can see below screenshot, unity credentials are getting passed to that action. Action will get access to shopify's credentials.

Screenshot_from_2022-01-02_16-46-48.png
Screenshot_from_2022-01-02_16-46-48.png From the original on HackerOne

Also, since github actions can create github tokens for use at run time using ${{ secrets.GITHUB_TOKEN }} an attacker can get access to all the private repositories of the organization

The original report as published on HackerOne, by codermak. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 referenced a third-party GitHub action by a username that had been renamed, and the old username was not reserved, allowing anyone to register it and control the action.

Impact

An attacker could register the old username and host a malicious action that runs when a pull request is made, gaining access to Shopify's credentials and potentially all private repositories in the organisation via the GitHub token.

What the attacker needed

The old GitHub username is unregistered; Attacker registers the old username; A pull request triggers the workflow

The fix

The workflow should reference the action by its current account name, and the old username should be reserved or the action replaced.

How it was found

  1. Open the Shopify repository's workflow file and locate the line using the external action.
  2. Observe that the action is referenced from the GitHub account MirrorNG/unity-runner.
  3. Visit that repository URL and note it redirects to a different account, MirageNet/unity-runner.
  4. Understand that the old username MirrorNG is now unregistered and available for anyone to claim.
  5. Visit the old account page and see the takeover message.

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 tasks that run when something happens in a repository, like a pull request. This workflow used a reusable action from another user's account, but that account had been renamed, freeing up the old name. Anyone could claim the old name and replace the action with malicious code, which would then run with the repository's 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 codermak

View all

10 more disclosed reports, best first.

More from Shopify

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.