Live data from Hacker News

You too can run malware from NPM (I mean without consequences)

github.com

101–110 of 122 posts

Re: You too can run malware from NPM (I mean without consequences)

#101

Glad to see this article raising awareness. Without fairness in the marketplace, the talent loses the will to play and the economy will further deteriorate. We are all suffering from an international trust breakdown from Covid, and now also from AI spam. If we don’t turn this tide, jobs and business opportunities are going to keep shrinking.

[deleted]

Re: You too can run malware from NPM (I mean without consequences)

#102

Seems like people already forgot about Jia Tan. By the way why doesn't npm have already a system in place to flag sketchy releases where most of the code looks normal and there is a newly added obfuscated code with hexadecimal variable names and array lookups for execution...

[deleted]

Re: You too can run malware from NPM (I mean without consequences)

#103

Earlier quoted context omitted.

A complexity per line check would have flagged it. Even a max line length check would have flagged it.

That would flag a huge percentage of JS packages that ship with minified code.

How are people verifying their dependencies if they are minified?

Re: You too can run malware from NPM (I mean without consequences)

#104

Earlier quoted context omitted.

That would flag a huge percentage of JS packages that ship with minified code.

How are people verifying their dependencies if they are minified?

That's the magic part, they aren't

Re: You too can run malware from NPM (I mean without consequences)

#105
post #79
post #55

Earlier quoted context omitted.

I'm often curious about how effective runtime quasi-sandboxing is in practice (at least until support at the TC39 level lands). My understanding is that if you can run with a CSP that prevents unsafe-eval, and you lock a utility package down to not be able to access the `window` object, you can prevent it from messing with, say, window.fetch. But what about a package that does assume the existence of window or global…

It's based on HardenedJS.org The sandbox itself is tight, there's a bug bounty even. The same technology is behind metamask snaps - plugins in a browser extension. And Moddable has their own implementation The biggest problem is endowing too powerful capabilities. We've got ambitious plans for isolating DOM, but that already failed once before.

so to answer the actual question. if something expects too much browser/dom access to work, it won't?

Re: You too can run malware from NPM (I mean without consequences)

#106

Earlier quoted context omitted.

That would flag a huge percentage of JS packages that ship with minified code.

How are people verifying their dependencies if they are minified?

My guy… in the JS ecosystem a “lock file” is something that restricts your package installer to an arbitrary range of packages, i.e. no restrictions at all and completely unpredictable. You have to go out of your way to “pin” a package to a specific version.

Re: You too can run malware from NPM (I mean without consequences)

#107

Earlier quoted context omitted.

How are people verifying their dependencies if they are minified?

My guy… in the JS ecosystem a “lock file” is something that restricts your package installer to an arbitrary range of packages, i.e. no restrictions at all and completely unpredictable. You have to go out of your way to “pin” a package to a specific version.

Lockfiles use exact hashes, not versions/version ranges. Javascript projects use two files, a package file with version ranges (used when upgrading) and a lockfile with the exact version (used in general when installing in an existing project).

Re: You too can run malware from NPM (I mean without consequences)

#108
post #107

Earlier quoted context omitted.

My guy… in the JS ecosystem a “lock file” is something that restricts your package installer to an arbitrary range of packages, i.e. no restrictions at all and completely unpredictable. You have to go out of your way to “pin” a package to a specific version.

Lockfiles use exact hashes, not versions/version ranges. Javascript projects use two files, a package file with version ranges (used when upgrading) and a lockfile with the exact version (used in general when installing in an existing project).

NPM is rather infamous for not exactly respecting the lockfile, however.

Re: You too can run malware from NPM (I mean without consequences)

#109
post #107

Earlier quoted context omitted.

My guy… in the JS ecosystem a “lock file” is something that restricts your package installer to an arbitrary range of packages, i.e. no restrictions at all and completely unpredictable. You have to go out of your way to “pin” a package to a specific version.

Lockfiles use exact hashes, not versions/version ranges. Javascript projects use two files, a package file with version ranges (used when upgrading) and a lockfile with the exact version (used in general when installing in an existing project).

Sure, but a lockfile with a hash doesn’t mean that next time it will fail if it tries to install a version of the package without that hash. If your package.json specifies a semver range then it’ll pull the latest minor or patch version (which is what happened in this case with e.g. duckdb@1.3.3) and ignore any hash differences if the version has changed. Hence why I say you need to go out of your way to specify an exact version in package.json and then the lock file will work as you might expect a “lock” file to work. (Back when I was an engineer and not a PM with deteriorating coding ability, I had to make a yarn plugin to pin each of our dependencies.)

The best way to manage JS dependencies is to pin them to exact versions and rely on renovate bot to update them. Then at least it’s your choice when your code changes. Ideally you can rebuild your project in a decade from now. But if that’s not possible then at least you should have a choice to accept or decline code changes in your dependencies. This is very hard to achieve by default in the JS ecosystem.

Re: You too can run malware from NPM (I mean without consequences)

#110

Earlier quoted context omitted.

Your grandma is a bike then. The 2fa is going to solve nothing and any attacker worth their salt knows it.

unphishable 2fa would have prevented this specific case tho... what are you talking about?

[dead]
Post reply on HN