Live data from Hacker News

Mini Shai-Hulud Strikes Again: 314 npm Packages Compromised

safedep.io

181–190 of 329 posts

Re: Mini Shai-Hulud Strikes Again: 314 npm Packages Compromised

#181
post #123

I'm very glad I never bought into fullstack JS/TS. My JS is frontend only, served as a compiled bundle off a server that doesn't even have a JS runtime of its own. Whatever random vulnerabilities the frontend contains are limited in blast radius to the user's own browser, and since all frontends should be untrusted anyway, there is no real security risk to the server or backend. No reason to update more than a few ti…

Also, I feel like a lot of fullstack JS is written by people who started with frontend JS and don't have nearly enough backend experience

JS programmers today are the PHP programmers of 25 years ago. Remember how many SQL injection bugs there was at the time? Little Bobby Tables remembers.

The standards haven't changed; for the vast majority of JS programmers, this is their first programming language and they have no solid foundation of architecture and security.

So what you get are these overly enthusiastic newbies that want to share their latest achievement with the world (say, a function to left pad a string), and why not include a fancy post-install script with emojis that makes adoption even simpler for other complete noobs? And this is the result.

Re: Mini Shai-Hulud Strikes Again: 314 npm Packages Compromised

#182
post #91

I can't wait for npm/github to do literally anything at all to mitigate these attacks. Literally anything. Have we considered a basic WAF-style block on some postinstall script strings? LLM-assisted code scanning on publish? Is there anyone home? No I suspect not.

It still seems wild that npm hasn't gone allowlist-only for pre- and post-install scripts like every other JS package manager (yarn, pnpm, Deno, Bun). Obviously it would be a breaking change that might wreck some developers' day for a little while until that allowlist is built, but it would go a long way to eliminate some of the biggest vectors for these attacks.

Re: Mini Shai-Hulud Strikes Again: 314 npm Packages Compromised

#183
post #65

‘No way to prevent this’, Says Only Development Community Where This Regularly Happens ­— https://itnext.io/no-way-to-prevent-this-says-only-developme... >

The "No way to prevent this" analogies seem to me to work better for Memory Safety because, as with Gun Safety, the simple fact is that everybody knows how to solve the problem, but one group insists it's impossible. There is crowing from the "Actually copy-paste is better" people when this happens, but when it's their turn they just jam their fingers in their ears. The memory safety and gun safety problems are the a…

I'll disagree because the primary issues with gun control in the US are:

[1] Guns are a core part of culture for much of America, very deeply so outside coastal cities. Most of the left wing in the US lives in coastal cities and either grew up there or immigrated very recently and does not leave, so this is an alien concept to them, but even in very blue cities like D.C. you would be shocked how many liberal democrats have armories. It is literally amendment #2!

[2] They are already widely distributed and it would be a logistical impossibility to actually enforce gun control.

This is directly analogous to NPM where:

[1] The package registry working the way it does and people quickly installing packages without thinking much is deeply part of JS culture. It doesn't help that JS caters very heavily to as wide of a market as possible, of which the majority is going to be entry level/junior to associate engineers for whomst script kiddying or letting AI install whatever is essentially a way of life. As evidence, this type of thing is not really a problem with derivatives like Bun, especially in mature organizations where it's easy to enforce a minimum 72 hour wait time between publish and installation of a package.

[2] Packages are already widely distributed and part of dependency stacks (e.g. the infamous leftpad) where it is a logistical impossibility to change how things work.

I also view startups and companies like Vercel as essentially the NRA here, Next.js has taken over huge swathes of the ecosystem and highly encourages dependency-maxxing.

Another direct analogy: proponents of gun control say they are unnecessary for self defense (esp. because law enforcement is good now), too heavy duty to begin with, and fundamentally dangerous.

Similarly I would criticize dependency-maxxing as unnecessary for capability (esp. because AI is good now), too heavy duty to begin with, and fundamentally dangerous.

Re: Mini Shai-Hulud Strikes Again: 314 npm Packages Compromised

#184
post #65

‘No way to prevent this’, Says Only Development Community Where This Regularly Happens ­— https://itnext.io/no-way-to-prevent-this-says-only-developme... >

Yeah funny, but npm is not the only development community where this regularly happens. The Onion article this joke refers to [1] is funny because there is a very clear and obvious reason why the U.S. has far more gun deaths per capita. This doesn't apply for npm. [1] https://theonion.com/no-way-to-prevent-this-says-only-nation...

> Yeah funny, but npm is not the only development community where this regularly happens.

What are the other ones? Does this happen with the same sort of frequency?

Re: Mini Shai-Hulud Strikes Again: 314 npm Packages Compromised

#185
post #95
post #65

‘No way to prevent this’, Says Only Development Community Where This Regularly Happens ­— https://itnext.io/no-way-to-prevent-this-says-only-developme... >

The Node ecosystem happens to be more vulnerable for social and software design reasons, it's true. But people need to be aware that PyPI and Cargo et. al. are not in any fundamental way less vulnerable. This will happen there too.

In fact, attacks like Shai-Hulud explicitly attempt to get into PyPI, and have succeeded to a lesser extent.

But aside from the package-size / -complexity issue pointed out in a sibling comment, PyPI also tries a fair bit to monitor for incoming malware (and there's a "report project as malware" button on each project page).

Also, there are no post-install scripts (of course, the code can detect when it's being run for the first time in the installed environment); and pre-install scripts are only included in sdists[0]. So you can easily[1] configure your installer such that you at least won't get pwned at install time, at the cost that some[2] packages can't be installed that way. And then you can go inspect, run a security scanner over, etc. whatever got installed; wheel installations just copy things to well-defined locations and generate simple wrapper scripts by strict rules.

[0]: I.e., when the project is "being built from source", which generally is only necessary when it includes non-Python code directly and the maintainer hasn't pre-built that code for your system.

[1]: Notwithstanding that, with pip, many actions that you'd expect not to get you pwned totally can. Such as, for example, explicitly telling it to download an sdist and not install it; as I discussed in https://zahlman.github.io/posts/python-packaging-3/ .

[2]: In practice, a pretty small fraction of what typical developers would actually care about, at least outside of specific niches. I'm told there are some niches where it's a big problem, but honestly they're lucky that this kind of build-install orchestration sort-of works at all.

Re: Mini Shai-Hulud Strikes Again: 314 npm Packages Compromised

#186
post #65

‘No way to prevent this’, Says Only Development Community Where This Regularly Happens ­— https://itnext.io/no-way-to-prevent-this-says-only-developme... >

The "No way to prevent this" analogies seem to me to work better for Memory Safety because, as with Gun Safety, the simple fact is that everybody knows how to solve the problem, but one group insists it's impossible. There is crowing from the "Actually copy-paste is better" people when this happens, but when it's their turn they just jam their fingers in their ears. The memory safety and gun safety problems are the a…

> the simple fact is that everybody knows how to solve the problem

Don't make braindead My First C Program mistakes?

Re: Mini Shai-Hulud Strikes Again: 314 npm Packages Compromised

#187

Earlier quoted context omitted.

The "No way to prevent this" analogies seem to me to work better for Memory Safety because, as with Gun Safety, the simple fact is that everybody knows how to solve the problem, but one group insists it's impossible. There is crowing from the "Actually copy-paste is better" people when this happens, but when it's their turn they just jam their fingers in their ears. The memory safety and gun safety problems are the a…

I'll disagree because the primary issues with gun control in the US are: [1] Guns are a core part of culture for much of America, very deeply so outside coastal cities. Most of the left wing in the US lives in coastal cities and either grew up there or immigrated very recently and does not leave, so this is an alien concept to them, but even in very blue cities like D.C. you would be shocked how many liberal democrat…

Gun deaths in the US are just the cost of doing business, and business is booming (for some).

Sad.

Re: Mini Shai-Hulud Strikes Again: 314 npm Packages Compromised

#188
post #91

I can't wait for npm/github to do literally anything at all to mitigate these attacks. Literally anything. Have we considered a basic WAF-style block on some postinstall script strings? LLM-assisted code scanning on publish? Is there anyone home? No I suspect not.

It still seems wild that npm hasn't gone allowlist-only for pre- and post-install scripts like every other JS package manager (yarn, pnpm, Deno, Bun). Obviously it would be a breaking change that might wreck some developers' day for a little while until that allowlist is built, but it would go a long way to eliminate some of the biggest vectors for these attacks.

... Deno and Bun manage packages? I thought they were just runtimes.

Re: Mini Shai-Hulud Strikes Again: 314 npm Packages Compromised

#189
post #3

Because of course it’s npm

Every programming language package manager is affected. Any random person can sign up and push packages. They are all equivalent to the Arch Linux User Repository and have the exact same caveats.

How many other languages of any kind have a standard library that is so bizarrely lacking as JS?

Now how many other mainstream languages of any kind have a standard library that is so lacking?

Now how many other mainstream languages have a swathe of front-end developers that suddenly realised they can run code in a CLI or on a server, and spent exactly 0 minutes learning about how to make it not shit?

Now how many other languages get used in scenarios where it makes absolutely zero sense because the developer only knows javascript?

Re: Mini Shai-Hulud Strikes Again: 314 npm Packages Compromised

#190
post #99

Earlier quoted context omitted.

We can’t even prevent shop lifting.

Compared to what?

Are you ok?

Compared to calling in air support on cyber criminals.

How’s your reading comprehension coming along?

Post reply on HN