Skip to content
Subdomain takeover Disclosed report Beginner

Dependency repository hijacking aka Repo Jacking from GitHub repo rubygems/bundler-site & rubygems/bundler.github.io + bundler.io docs

The Bundler documentation linked to a GitHub repository whose owner had changed their username, leaving the old username available for anyone to register. An attacker could register that username and recreate the repository to serve malicious code to users who followed the documentation link.

akincibor Follow

Originally disclosed on HackerOne

  • Disclosed after 18 hours

Dependency repository hijacking (aka repo jacking) is an obscure supply chain vulnerability, conceptually similar to subdomain takeover. When the linked repository owner changes their username, it becomes immediately available to be re-registered by anyone. This means that any project that linked back to the original repository URL has now become vulnerable to remote code injection through dependency hijacking. A malicious attacker can register the old GitHub username, recreate the repository, and use it to serve malicious code to any project that depends on it.

Step to produce PoC

  1. Go to https://bundler.io/v2.2/guides/bundler_plugins.html
  2. At the bottom, you will see: "Example Plugins"
Capture_d__cran_2021-12-18___17.44.55.png
Capture_d__cran_2021-12-18___17.44.55.png From the original on HackerOne
  1. Click here kddeisz/bundler-console, you will see the Takeover message.
Capture_d__cran_2021-12-18___17.45.19.png
Capture_d__cran_2021-12-18___17.45.19.png From the original on HackerOne

Remediation

I found a total of 12 places where this url is located and should be updated ASAP:

Capture_d__cran_2021-12-18___15.41.51.png
Capture_d__cran_2021-12-18___15.41.51.png From the original on HackerOne

Impact

As an attacker, I can host malicious content on the compromised Github repository. I can also host an SDK or malware, which the user will think is part of the plugins as it is referenced in your documentation, which can lead to an RCE for users referring to your documentation.

Attachments

Capture_d__cran_2021-12-18___17.39.00.png
Capture_d__cran_2021-12-18___17.39.00.png From the original on HackerOne

The original report as published on HackerOne, by akincibor. 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 documentation contained hard-coded links to a GitHub repository under a username that was later changed, and the old username was not reserved or the links updated.

Impact

An attacker could host malicious content on the compromised GitHub repository, potentially leading to remote code execution for users who follow the documentation.

What the attacker needed

Attacker registers old username; victim visits documentation link

The fix

The documentation links should be updated to point to the correct repository owner.

How it was found

  1. Visit the Bundler plugins guide page.
  2. Scroll to the 'Example Plugins' section.
  3. Click the link to the bundler-console repository.
  4. Observe that the link leads to a GitHub takeover message instead of the real repository.

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 someone changes their username on GitHub, their old username becomes free for anyone else to claim. If a website still links to the old username, a malicious person can take over that link and show their own code. Here, the Bundler documentation pointed to an old username, so an attacker could pretend to be the original plugin author.

What is Subdomain takeover?

A company's DNS still points at a cloud service it no longer uses, so anyone can claim it and serve content on the company's domain.

More from RubyGems

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Subdomain takeover

The lesson behind this report.

A company's DNS still points at a cloud service it no longer uses, so anyone can claim it and serve content on the company's domain.