30 ms·
NPM repository flooded with 15,000 phishing packages
- egberts1 4y agoYeah, the one prominent thing that is missing from NPM packaging procedure is the PGP/GnuPG signing procedure. Otherwise, it is way too easy to automate the submission.
- janosdebugs 4y agoHow would package signing have prevented this?
- eternauta3k 4y agoSigning + web of trust might hinder this.
- zachlatta 4y agoI don’t think it’s realistic to expect people to maintain a web of trust.
- shadowgovt 4y agoOh, it never has been; huge pain in the ass. ... we do it anyway because the alternative is to just get 0wnz3d by bad actors.
- salawat 4y ago^...The most insightful comment of the day, right here.
- shadowgovt 4y agoThe signatures would have to be rooted to a trust cert model (with a way for devs to verify that the "Microsoft" they're pulling a package from is the real "Microsoft"). Hypothetically, this could be done: put up a public key at a known domain, sign packages via public key, and if the package manager extends to include a "fetch from URL provided by the package and check signature" tool, we end up rooting trust in packages in trust in domain name ownership; not too shabby. We still need devs to actually bother to do the check and, like, read the domain name to make sure they haven't accepted authorization from "micr0soft.com", but the end result is a distributed signing solution that doesn't require any centralized authority (except, indirectly, the SSL cert issuers and DNS providers of the world).
- bombolo 4y agoNo there would not necessarily be a need for this. You could have alerts when an old account is using a new key that nobody has seen before, for example.
- remram 4y agoIf you don't know the author, signatures do nothing. Anybody can sign their package with some key. Even if you could check the author's identity, that still does very little for you, unless you know them personally. It makes a lot more sense to use cryptography to verify that releases are not malicious directly. Tools like crev [1], vouch [2], and cargo-vet [3] allow you to trust your colleagues or specific people to review packages before you install them. That way you don't have to trust their authors or package repositories at all. That seems like a much more viable path forward than expecting package repositories to audit packages or trying to assign trust onto random developers. [1]: https://github.com/crev-dev/crev https://github.com/crev-dev/crev [2]: https://github.com/vouch-dev/vouch https://github.com/vouch-dev/vouch [3]: https://github.com/mozilla/cargo-vet https://github.com/mozilla/cargo-vet
- salawat 4y agoYou have now just transferred risk. You have done nothing to mitigate it, and created more work for those of us that actually do read code. Then again, if someone wants to pay me to do nothing but read and vouchsafe code, hell, why not. As QA I basically do that anyway. Will have to think on this.
- remram 4y agoI don't see it as "transferred risk". As individuals we already have people we trust and people we don't know. This system allows you to get trust in your dependencies without requiring to trust the specific rando that authored the specific library you want to use. Yes ultimately someone you trust has to vouch for the library for you to trust it. That's unavoidable either way. Those systems only allow for that person to be anyone instead of just the author.
- loic-sharma 4y agoThe .NET ecosystem has this [1], so far adoption has been low. Similar to HTTPS until LetsEncrypt, we need something that’s more convenient if we want developer adoption. [1]: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-trust#description https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-n...
- duskwuff 4y ago> Otherwise, it is way too easy to automate the submission. Automating GPG signatures is trivial. GPG is not an anti-spam mechanism.
- fwlr 4y agoMore supply-chain attacks, though these (clickbait package names, monetized with referral links) are certainly less sophisticated and less dangerous than the wave that hit PyPI (typos of common package names, monetized by altering crypto addresses in your clipboard / paste buffer). As they say, the best time to start mitigating these attacks was 10 years ago; the next best time is today.
- ok123456 4y agoI'm now double and triple checking when I add a package to the manifest. You have to check not only that it's the right package, you also check that it has the number of downloads that you're expecting.
- z3t4 4y agoYou should also read the source code. Developers are probably the only profession that blindly trusts their peers.
- scarby2 4y agomost engineers blindly trust things when another engineer or vendor has signed off/certified on it. There's simply not enough time in the world to go through the certification date for every single part you use in a project. We trust that there has been a testing process that validates that things do what they say they will do. Admittedly when dealing with non-OSS vendors you can sue them if something goes badly wrong.
- dgb23 4y agoIt’s perfectly normal to trust your peers in a collaborative setting regardless of the profession. The issue is rather that this is only a largely collaborative one. Which makes the thing kind of worse, because you can _often_ get away with simply trusting everyone and there are economic and practical pressures to do so.
- ashishbijlani 4y agoThe problem with using downloads as a proxy for "safety" is that a bad actor can use CI infra/bots/scripts to inflate the number. This is why in Packj [1] we check for multiple attributes (e.g., dependents). 1. https://github.com/ossillate-inc/packj https://github.com/ossillate-inc/packj
- tracker1 4y agoI'm thinking that creating new packages in a language repo should check for one/two off naming from popular packages and just block them.
- Etheryte 4y agoDid you read the article? This attack was not about naming malicious packages similar to legit ones or common typos of them. > A large number of corrupted packages use names related to game cheats, free resources, and social media platforms, such as "free-tiktok-followers" and "free-xbox-codes," to entice users to click the links and direct them to multiple well-designed phishing webpages.
- duskwuff 4y agoThose honestly sound like they're just using NPM as a platform to host their spam. All the spammers care about is that they get to host their content on a trusted domain with a keyword-dense URL; there's no expectation that anyone actually install the package. The same problem exists on Docker Hub, e.g. https://hub.docker.com/r/neyprivedpu1972/windows-7-7264-download-iso-torrent https://hub.docker.com/r/neyprivedpu1972/windows-7-7264-down...
- stingraycharles 4y agoI feel that that is one of those ideas that sound great in theory, but is impractical in reality. There are way too many packages with similar names already but are completely valid. What makes me wonder is why it’s always NPM that’s hit with these kind of things, and not, say, Maven? Arguably the attack surface of Maven is much larger and intrusive (lots of enterprises), but the mechanisms of package distribution are completely different. There are a shitload of scans and sanity checks happening when you push a package to a Maven repo such as Sonatype, which I don’t see as much with NPM (and also Pypi for that matter) (fwiw, I am responsible for package distribution of all APIs of a reasonably popular timeseries database)
- krinchan 4y agoMost of these package systems being attacked run arbitrary code on your system when you install the package in order to allow native extensions to compile. Maven/Java simply downloads a (relatively) inert zip archive that your IDE might do some static analysis on to provide autocomplete. Along with all the scanning and what not, I think that’s the biggest reason you see attacks primarily on npm, PyPi, and to an extent Ruby Gems.
- ashishbijlani 4y agoPlug: We've been building Packj [1] to detect such malicious, abandoned, typo-squatting, and other "weak links" in your software supply chain. Supports auditing as well as install-time sandboxing of PyPI/NPM/Ruby packages. It carries out static/dynamic/metadata analysis to look for "suspicious” attributes such as spawning of shell, use of SSH keys, network communication, use of decode+eval, mismatch of GitHub code vs packaged code (provenance), change in APIs across versions, and several more. 1. https://github.com/ossillate-inc/packj https://github.com/ossillate-inc/packj
- booi 4y agoBut how will we audit the auditor? taps head
- ashishbijlani 4y agoThis is a valid concern. That is why we're building this in the open. You can take a look at the code. We welcome your feedback/suggestions and code contributions to add new security checks/policies.
- salawat 4y ago>That is why we're building this in the open. You can take a look at the code. ...You mean, in the same manner everyone should have been auditing code all along, but hasn't, thereby creating the problem you're trying to solve? It's alright. You're trying, and there's nothing wrong with that answer, but the people you're trying to sell a shovel to don't want to dig. That's the chief problem.
- swatcoder 4y agoYou’re not wrong, but at some point, the dependency problem will slip onto someone’s desk in then legal department and rules will be pushed back across the hall into the engineering department. It’s not a bad idea to stake out a product that’s mature and ready to go when that happens. It doesn’t even have to be foolproof. It just needs to be earnest enough to check off some boxes and show that “best practice” effort was made.
- rogerbinns 4y agoI find it a bit strange that NPM and PyPI decided to have a single global namespace for packages. When there aren't very many packages it is more convenient, but you very quickly run into issues of ownership of the names. This happened before during the glory days of SourceForge where project names were global, and there was all the resulting control and misdirection issues. Thankfully Github made it a two level namespace OWNER/PROJECT which vastly reduced the problems. IMHO the repositories will need to do something similar.
- miohtama 4y agoNPM has namespaces
- rogerbinns 4y agoNamespaces seem to be in the minority. For example searching for sqlite shows 124 pages where the vast majority of packages have no namespace. https://www.npmjs.com/search?q=sqlite https://www.npmjs.com/search?q=sqlite
- mort96 4y agoIt has namespaces, but for the most part, packages are in the global namespace, most people publish packages there and most programmers use packages there. Namespaces aren't unused or useless in the NPM, but the fact that most packages people use aren't in namespaces means they don't do much for security.
- miohtama 4y agoI agree with you. My point was about that in this case the problem is the users, or education, not the available features.
- woodruffw 4y agoI can understand not liking it, but I don't understand why you find it strange: global namespaces are the norm in language package distribution. RubyGems, NPM, PyPI, and Crates all use flat namespaces (either by default or as their only supported mode). Namespace partitioning has advantages, but it also doesn't solve squatting problems on its own: anybody (or any process) that's fooled by `requests` vs `pyrequests` is also going to be fooled by `some-owner/requests` vs. `requests-org/requests` (the latter being the fake one).
- amrb 4y agoBurn NPM to the ground and start over.. A ball of mud will not be fixed.
- bluetidepro 4y agoSlightly off topic, but it's so odd/annoying to me that they used a GIANT TikTok logo image as the header photo for this article. Then the only ref to TikTok after is: > A large number of corrupted packages use names related to game cheats, free resources, and social media platforms, such as "free-tiktok-followers" and "free-xbox-codes," to entice users to click the links and direct them to multiple well-designed phishing webpages. So just because the spammers are using the TikTok brand/name in their spam (also mentioned is "xbox" but they didn't use the Microsoft logo), they used THAT as the image? Not the NPM logo or something much more relevant? I know it's minor, but that rubs me the wrong way as very "sus" and clickbait for when the article is used on social sharing sites and they most likely pick that image as the article open graph image. You also know it's most likely for clickbait because the avg person is much more likely to click some link with the TikTok logo and "phishing" in the title, vs some NPM logo that they may not even know.
- discardedrefuse 4y agoIt's kind of hilarious. They used the same tactic as the scammers!
- andy_ppp 4y agoI really don’t like one bit the design of npm. Projects should specify their dependencies not packages. For example if one of my dependencies uses leftPad in my project I should have to specify leftPad as a dependency. This would encourage much better behaviour with dependencies because the costs would be crystal clear if it has 50000 dependencies you’d probably avoid installing it. It would also discourage lots of very small packages or you might even choose to add a version of leftPad to your codebase rather than let someone else be in charge of what is in it. Maybe the ship has sailed on JS/TS now but it would also discourage needless package churn.
- capableweb 4y agoWhat problem does this try to solve? That a lot of packages are being downloaded? You could already do what you're describing today, but odds are, you don't, because you value your time more than you value "having small amount of packages" for whatever reason.
- bombolo 4y agoSmall amount of packages might very well lead to curated and well maintained libraries that do many things (as opposed to having 1 library per string function).
- andy_ppp 4y agoI’m just saying building a system that encourages/hides dependencies leads to bad software engineering in my opinion. Elixir does it the way I’ve outlined and I think that’s one of the many decisions they got right.
- Joeri 4y agoUnder the npm model you are trusting the authors of your direct dependencies with judicious choice of transitive dependencies, and then those authors in turn trust the authors of their dependencies. In essence npm is a system that relies on a web of trust. A system like that cannot give any modicum of control, because typically a real world project will involve hundreds of package publishers, any one of which can break that trust with a poisoned patch version of a transitive dependency (or can be hacked), and it is effectively impossible to review all those dependencies every time they do a patch version bump. So developing with npm is always an act of faith that everyone will do the right thing. The remarkable part is how rarely it breaks down.
- stuckinhell 4y agoThis a combination of a technology and a people problem. As layoffs increase, as the economic conditions worsen, this will get worse. People all over the world are getting desperate.
- nnurmanov 4y agoThere is another thing, a number of packages have critical vulnerabilities, shouldn’t they restrict such packages as well?
- hulitu 4y agoIt is not the first time npm is distributing malware. npm shall be treated as malware until developers fix this issue.
- stilist 4y agoWould https://checkmarx.com/blog/how-npm-packages-were-used-to-spread-phishing-links/ https://checkmarx.com/blog/how-npm-packages-were-used-to-spr... be a better URL? The current URL (https://www.scmagazine.com/analysis/devops/npm-repository-15000-phishing-packages https://www.scmagazine.com/analysis/devops/npm-repository-15...) seems like a summary of the original.
- freeqaz 4y agoThe lead is buried at the bottom of the article (imo). > "While being flooded with spam is never good, it gets immediately noticed and mitigated. It's harder for open source projects to spot and stop rare one-offs" This is the real problem that NPM and other ecosystems face. A determined attacker that is trying to "poison" a popular Open Source package just has to feign as a maintainer long enough to succeed[0]. Defeating these types of attacks will require rethinking how we think about trust of packages. Projects like Deno are one approach (fork the ecosystem) while projects like Packj (mentioned elsewhere here), Socket.dev, and LunaTrace[1] are taking the other angle (make it harder to install malware). It's hard to say which approach is better right away. (Probably a hybrid of both, realistically) It's just non-trivial to fix this in one clean swoop. It's messy. 0: https://www.trendmicro.com/vinfo/us/security/news/cybercrime-and-digital-threats/hacker-infects-node-js-package-to-steal-from-bitcoin-wallets https://www.trendmicro.com/vinfo/us/security/news/cybercrime... 1: https://github.com/lunasec-io/lunasec https://github.com/lunasec-io/lunasec
- verdverm 4y agoGo's take is to fetch from the code host, so there is no module registry at all. Curious if others find this reassuring in light of registry attacks?
- junon 4y agoNo. The tradeoffs don't make any sense. With a registry you have some sort of guarantees, mirrors, etc. The same isn't true with individually owned repositories.
- freeqaz 4y agoIt's hard for the enterprise world because they need to mirror everything internally. (That's a doable problem and I believe Google proxies all Golang installs already.) There are still issues with things like history being re-written if you're pinned to a tag instead of a commit... since potentially the hash might change and you can't necessarily understand what changed unless you have a copy of the original code still. That said, I feel like the bigger challenge here is with transitive dependencies (and a large total number of dependencies) because they create more places for malware to "hide", so to speak. If every time I bump a package, it bumps 50 others... am I really going to notice/review the changes in all of those? Odds are I'm just trying to ship some feature or do something else! The libraries are rarely the center of my focus. (Maybe you get a PR with a security fix that you land it without thinking. Surprise, malware!) It's an insidious problem without a very clear cut solution. Do we stop using Open Source code? Probably not. So how do we adapt? TBD!