Live data from Hacker News

Embedded malware in RC (NPM package)

github.com

41–50 of 117 posts

Re: Embedded malware in RC (NPM package)

#41

If you're interested in preventing this sort of thing, I'd appreciate comments on this [RFC]( https://github.com/npm/rfcs/pull/488 ) I just submitted to npm to make install scripts opt-in instead of default behavior . While of course not perfect, this simple change would certainly go a long way in increasing the difficulty in creating these sorts of attacks, as right now as long as a computer even installs the packag…

Non-tech solution is to pin versions and read (hacker)news before updating.

Re: Embedded malware in RC (NPM package)

#42

I've created Vouch in an attempt to address this problem: https://github.com/vouch-dev/vouch Vouch lets users create and share reviews for NPM packages. Project dependencies can then be checked against those reviews. Vouch uses extensions to interface with package ecosystems. It's simple to create a new extension. Extensions currently exist for NPM, PyPi, and Ansible Galaxy. I'm currently working on a website to inde…

That's not really the solution for this problem, though, which is very specifically when a project maintainer's account gets compromised, so then the bad guys publish a new malicious version of that library that gets picked up by anyone using non-pinned NPM versions (i.e. most everyone). There are a couple more straightforward ways to do this: 1. Require 2FA, ideally hardware key 2FA, for anyone publishing a package…

2. Make running of preinstall/install scripts opt-in. They already are, npm install --ignore-scripts

Re: Embedded malware in RC (NPM package)

#43

I've created Vouch in an attempt to address this problem: https://github.com/vouch-dev/vouch Vouch lets users create and share reviews for NPM packages. Project dependencies can then be checked against those reviews. Vouch uses extensions to interface with package ecosystems. It's simple to create a new extension. Extensions currently exist for NPM, PyPi, and Ansible Galaxy. I'm currently working on a website to inde…

I'd like this to work, but it seems like it relies on packages being statically "good" or "bad" - what happens if a package is legitimately well trusted but then the main dev gets backdoored and a bit of extra code is injected?

That extra code will stand out as not having been reviewed.

Re: Embedded malware in RC (NPM package)

#44
post #33

I've created Vouch in an attempt to address this problem: https://github.com/vouch-dev/vouch Vouch lets users create and share reviews for NPM packages. Project dependencies can then be checked against those reviews. Vouch uses extensions to interface with package ecosystems. It's simple to create a new extension. Extensions currently exist for NPM, PyPi, and Ansible Galaxy. I'm currently working on a website to inde…

Sounds really interesting. I'm kinda scared to use npm right now to be honest. What dangers may be hidden deep in the dependency trees? But is a review of every update then done, because rc used to be a legit package?

A review corresponds to a particular version number. But the review process does not need to start from scratch with each version number increment. Reviews from previous versions can be leveraged to lessen the workload.

Re: Embedded malware in RC (NPM package)

#45

I've created Vouch in an attempt to address this problem: https://github.com/vouch-dev/vouch Vouch lets users create and share reviews for NPM packages. Project dependencies can then be checked against those reviews. Vouch uses extensions to interface with package ecosystems. It's simple to create a new extension. Extensions currently exist for NPM, PyPi, and Ansible Galaxy. I'm currently working on a website to inde…

That's not really the solution for this problem, though, which is very specifically when a project maintainer's account gets compromised, so then the bad guys publish a new malicious version of that library that gets picked up by anyone using non-pinned NPM versions (i.e. most everyone). There are a couple more straightforward ways to do this: 1. Require 2FA, ideally hardware key 2FA, for anyone publishing a package…

Reviews in Vouch refer to a particular version of a software package. If a new release is issued by a malicious actor, the new release would require a new review.

But the review process does not need to re-start from scratch. Reviews from other versions can be used to lessen the workload.

On the subject of automatically updating packages: the Vouch dependency analysis can be included in CI. Un-reviewed or review failing dependency updates can be flagged for attention.

Re: Embedded malware in RC (NPM package)

#46

Earlier quoted context omitted.

I'd like this to work, but it seems like it relies on packages being statically "good" or "bad" - what happens if a package is legitimately well trusted but then the main dev gets backdoored and a bit of extra code is injected?

That extra code will stand out as not having been reviewed.

Oh, you mean to have reviewers look at every line of every version (at least cumulatively). Yes, that would work, and while the effort is significant I appreciate that it's the effort you'd want regardless so this helps share the load.

Re: Embedded malware in RC (NPM package)

#47
This is why JS runtimes should add the ability to set permissions on a per-module basis. Deno is a step in the right direction by requiring permissions for a script to be specified (e.g. deno run --allow-read --allow-net myscript.ts), but the permissions are global for the entire script and can't (yet?) be configured differently for each module / dependency.

Re: Embedded malware in RC (NPM package)

#48

Earlier quoted context omitted.

That's not really the solution for this problem, though, which is very specifically when a project maintainer's account gets compromised, so then the bad guys publish a new malicious version of that library that gets picked up by anyone using non-pinned NPM versions (i.e. most everyone). There are a couple more straightforward ways to do this: 1. Require 2FA, ideally hardware key 2FA, for anyone publishing a package…

2. Make running of preinstall/install scripts opt-in. They already are, npm install --ignore-scripts

What you've written there is literally the definition of opt out.

Re: Embedded malware in RC (NPM package)

#49
post #9

Earlier quoted context omitted.

Command line argument parsing and config loading both seem like very sensible library abstractions to me. This isn’t leftpad.

>Command line argument parsing 20-30 LoC maybe. `process.argv.slice(2).forEach(str => ... )`. there is no access to the raw command-line invocation, sadly, so you really can't really do anything fancier than that. >config loading that thing "RC" package does - looking up the config file in random locations - is really strange to me. aren't you the one in control of where it is stored?

Just looking at the readme for Coa it’s very obviously more than the code you outlined. You’re arguing against a strawman here.

Re: Embedded malware in RC (NPM package)

#50
post #23

Earlier quoted context omitted.

Given that these attacks are becoming increasingly common, package registries could at least install each package (prior to publishing) in some isolated container or VM and then run some similar malware detection on the resulting file system. Honestly, I'm strongly considering moving away from the NPM ecosystem because it's clearly become a target for malware.

But attackers are not dumb. They would circumvent whether loose checks the package manager may have. Just considering your suggestion, the obvious immediate exploit is to not deploy the attack payload right away. Nothing you will think of will evade defeat.

“Don’t let perfect be the enemy of good”
Post reply on HN