Millions of GitHub repos likely vulnerable to RepoJacking, researchers say
bleepingcomputer.com
bleepingcomputer.com
Why is this news, and why does it need a name of "RepoJacking" assigned to it when the behaviour is working exactly as designed?
This isn't a novel vulnerability, and I wouldn't say any novel vulnerability research has been conducted here. Sure, there's some value in doing a code search and finding instances where people have automated scripts etc relying on aliases, but the vulnerability lies within these scripts.
I didn't know you could get street cred pointing this out one by one.
Let's try! If someone buys an expired domain and installs an SSL cert on it then old scripts will think it's legit. Let's call it phantomain, a combination of phantom and domain.
Ghomainjacking but it's pronounced fimainjacking using the gho from ghoti because it's in the class of phishing attacks using a collision you didn't realize was possible
https://help.twitter.com/en/using-twitter/delete-tweets
See "How to delete multiple Tweets".
As bad as it sounds.
A repo that is an alias to another one. Someone can create this repo breaking the alias and thus being able to serve whatever they want. This is the so-called "repojacking" and what GP is also talking about.
But this article describes RepoJacking as reclaiming the original repo. The alias is removed, and the warning you mention too.
The repository maintainers would, every single time they updated the code.
For your own scripts, you'd see a 301 Moved Permanently response when e.g. fetching a source code ZIP. It's up to you as to whether you want to follow this redirect silently or print a warning.
If GitHub is concerned with people burning through names, they could either limit the number of changes before you have to reach out to support or limit the redirect behavior to just the last two org names.
It's such a big deal that I don't think anyone's going to take it seriously until the compromises start coming in waves. Just one of these compromises could affect thousands of projects. If there are millions of potential exploits? We're talking, like, the majority of the modern software landscape now has a giant hole in it. Not a potential hole, but, actively, right now, is exploitable.
1. http://github.com/ossillate-inc/packj flags vulnerable/malicious NPM/PyPI/Rubygems/Cargo/Packagist packages. I'm the lead dev.
If you look at the IDs for multiple accounts, you'll very quickly notice that they seem to have been assigned sequentially at registration time.
Fairly sure this is a permanent deal.
[1]: https://docs.github.com/en/rest/users/users?apiVersion=2022-...
This is debatable. If the owner unpublishes their old releases, then the npm install would simply fail and the package reference string is burned forever. I don't like the implication this post makes that other package managers don't require code execution to install, or that npm is somehow more vulnerable.
> Registry data is immutable, meaning once published, a package cannot change. We do this for reasons of security and stability of the users who depend on those packages. So if you've ever published a package called "bob" at version 1.1.0, no other package can ever be published with that name at that version. This is true even if that package is unpublished.
https://docs.npmjs.com/policies/unpublish
https://docs.npmjs.com/cli/v9/commands/npm-unpublish
To hijack an npm package is to exploit sloppy code review somewhere in the dependency tree. The registry has nothing to do with this.
Being aware of this policy, requiring maintainers to review all changes to "package-lock.json", and keeping this lock file in your repo ("npm-shrinkwrap.json" for releases) entirely mitigates this.
https://docs.npmjs.com/cli/v9/configuring-npm/package-lock-j...
It's also important to regularly run npm audit on all releases and unpublish if vulnerabilities are found in the dependency tree of that lock file. It's better to break someone's build and leave a note that they need to upgrade than be part of the problem. Even further, npm audit reports are shown to the end user after an npm install so they can decide for themselves in the event the maintainers haven't unpublished yet (or ever).
But that's more or less true. Arbitrary code execution isn't a feature needed when installing packages for other languages that don't use C bindings so heavily.
You're spot on that Node.js isn't alone, Python packages are very much the same in that packages can require code execution to install.
But not all packaging systems require the ability to execute package provided code in order to install some packages.
But then, in those languages, binding to C libs is far far less common.