HexBrain

RubyGems · Report #1430405

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

Informativestatus
mediumseverity
12upvotes
19 Dec 2021disclosed

How it was found

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"

{F1551051}

  1. Click here kddeisz/bundler-console, you will see the Takeover message.

{F1551052}

Remediation

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

{F1551049}

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.

This report was disclosed publicly on HackerOne and belongs to its author and the program. See the original