Really is a very creative attack. Still, my understanding is that at the very core, it's still a case of social engineering. The attacker couldn't have done this if he hadn't been given full access to the git repo. I've seen a lot of people blaming NPM for this, but surely this attack would've been possible in any environment which uses package management, be it NPM, Nuget, Maven, pip or any other. The only exception I can see here is that it's harder to detect here, due to the custom of minifying, as my understanding from this summary is that the malicious code was only present in the minified version.
Also, it's easier in JS community, because of this fragmentation of nano packages. For example you can trust Facebook and use React package. But React uses probably dozen of other packages. Every this package uses dozen of another. Ultimately you are now using 200 packages from over 100 developers. Many of those packages are not maintained anymore. Many of those packages are vulnerable to hacking. Hacker only have to hack one small forgotten package on bottom of this dependency chain.
JS community should stop with this nano packages obsession. Every package developer / maintainer should aim for as low dependencies as possible. Currently it works in the opposite direction - many prefers to add new dependency instead of writing 10 lines of code.
NPM website says "What can you make with 700,000 building blocks? The npm registry hosts the world’s largest collection of free, reusable code.". In my opinion it's nothing to be proud of. It only shows that developers prefer to create new packages instead of working together. I don't need 20 packages for reversing string. I only need one good package containing string functions (among many other functions). Such, which is developed and maintained by more than single developer.
Some time ago i compared how many packages were installed by installing one popular dev tool package. Here are results (probably now will be different):
Yes, and I definitely agree that overuse of dependencies is a major factor in this, but I still don't see how that's an issue with NPM itself. The userbase is doing unsafe things, but it's not an inherent issue with NPM. There's nothing actually stopping people from creating packages for Nuget or Maven which has 200 dependencies, it's just not how things are generally done there. The issue is still with the users of NPM blindly using dependencies for every little thing, to the point that nobody can keep track of them. I fail to see how a package manager could possibly solve that.
The language itself is a major part of the problem. .NET/Nuget doesn't have the same issue because .NET contains an extensive set of APIs, and so you don't need to install a package to do basic things. Instead, you're more likely to install libraries like AutoMapper. But with JS, there's no decent standard lib, so developers fill the gaps when they need with small packages that fill that need.
I do think the more popular packages like webpack, Angular, React etc should look to using far less dependencies and write their own implementations.
The language itself is a major part of the problem.
And even a bigger part than people might think.
It's a very clear example of how powerful linguistic relativism is. This reckless sloppy mentality is induced by the language itself. Anyone using JavaScript is unavoidably falling prey to the JavaScript mentality, and the npm shitshow is a direct consequence of this influence of the language semantics on human minds.
15
u/Vakz Nov 28 '18
Really is a very creative attack. Still, my understanding is that at the very core, it's still a case of social engineering. The attacker couldn't have done this if he hadn't been given full access to the git repo. I've seen a lot of people blaming NPM for this, but surely this attack would've been possible in any environment which uses package management, be it NPM, Nuget, Maven, pip or any other. The only exception I can see here is that it's harder to detect here, due to the custom of minifying, as my understanding from this summary is that the malicious code was only present in the minified version.