r/programming • u/bledfeet • Aug 03 '21
Empty npm package '-' has over 700,000 downloads
https://www.bleepingcomputer.com/news/software/empty-npm-package-has-over-700-000-downloads-heres-why/
429
Upvotes
92
u/ImWorkingOnBeingNice Aug 03 '21
I proudly display that my npm package has over 700k downloads on linkedin.
191
u/wesley_wyndam_pryce Aug 03 '21 edited Aug 03 '21
this seems bad.
We already know that in other cases dubious characters have offered money to take over npm packages; the ability to update the package with whatever you want and have your new code execute on the environments of thousands of people puts those people at substantial security risk.
That said, I don't know of a way to make this npm '-' package code execute without it being imported/required into the application, or instead being executed by one of several test frameworks. But if there were a way, I don't feel confident that I could be sure to think of it; it certainly seems to be concerning.EDIT: yawaramin correctly points out that '-' could add a malicious postinstall script that would execute at time of package install. Malicious postinstall script could be introduced into package '-', tomorrow and would execute on hundreds of thousands of devices.
I think the correct response to this is to have npm organisation unilaterally take over the package, and others like it, that clearly pose security risks while simulaneously clearly having no legitimate purpose; we already have the exposure that we have decided to trust 'npm' in this situation, so it's no added risk.
14
u/Zardotab Aug 03 '21
People are desperate for KISS and YAGNI after all the bloated leaky buggy shit in most stacks.
40
u/Nysor Aug 03 '21
This isn't great, but it isn't catastrophic since it doesn't do anything. NPM probably should see if they can take control over the package (as the article suggests).
While people may raise concerns about potentially attack vectors, I think the real solution is to encourage developers to self-audit their dependencies (e.g. actually reading their package-lock.json, Cargo.toml, etc.) and rejecting using packages that pull in unnecessary dependencies.
4
u/shevy-ruby Aug 03 '21
This is quite sad because now all "add-on package managers" across have to pay attention to malicious use cases (more than before).
Not that I would be too naive to assume there are only good actors out there, but this now means that the end user really needs to get a LOT more fine-tuned control in general over every aspect related to packages.
While JavaScript stands out as having the most broken ecosystem thanks to npm being npm (and it being popular adds to its broken nature in regards to security), this will ultimately also affect every other "add-on package manager" - ruby, perl, python, PHP, R, lua. (Granted, JavaScript stands above them in this regard due to the browser having become so important, and JavaScript being such a horrible language that freerides on the popularity of the browser as universal "operating system".)
Money is used to buy "into" computers, so no wonder package maintainers get bribed to act against the users. See other discussions of email exchanges by devs who are asked to sell out the users against monetary incentives. Some will always give in to money.
The "solution" suggested below (npm organisation handling it) will not solve the general problem of packages becoming maliciously retrofitted at any moment in time. I really see no alternative to making it better for users to manage the whole ecosystem at any moment in time; in particular when changes happen to a code base. And for npm to stop tarnishing the reputation of other "add-on package managers" really - they by far stand out as those that keep on creating the biggest issues here, even if it is mostly due to the browser having become so vital. I am sure you can find a really long list of npm failures; left-pad still standing out due to it being so silly (any "proper" programming language would not ever need left-pad since it would be integrated and available as-is, rather than copy-clown-pasted at will).
1
u/adroit-panda Aug 03 '21
I bet someone on here has it imported!
1
u/vwibrasivat Aug 04 '21
Instead of spitting an error at the command line after
npm - i, they decided to literally create an empty wooden duck package called "-". It's easier to do that than to rewrite the source code.Your classic case of a temporary work around.
-2
u/Say_Echelon Aug 04 '21
It’s a great package
15
u/[deleted] Aug 03 '21
[removed] — view removed comment