logoalt Hacker News

GitLab discovers widespread NPM supply chain attack

364 pointsby OuterValeyesterday at 3:36 PM214 commentsview on HN

Comments

qubextoday at 10:25 AM

About a month ago I had a rather annoying task to perform, and I found an NPM package that handled it. I threw “brew install NPM” or whatever onto the terminal and watched a veritable deluge of dependencies download and install. Then I typed in ‘npm ’ and my hand hovered on the keyboard after the space as I suddenly thought long and hard about where I was on the risk/benefit curve and then I backspaced and typed “brew uninstall npm” instead, and eventually strung together an oldschool unix utilities pipeline with some awk thrown in. Probably the best decision of my life, in retrospect.

show 5 replies
csutil-comtoday at 9:21 PM

Can't GitHub just block/make private all https://github.com/search?q=Sha1-Hulud%3A%20The%20Second%20C... repos as a first step?

mikkupikkutoday at 11:38 AM

> "This creates a dangerous scenario. If GitHub mass-deletes the malware's repositories or npm bulk-revokes compromised tokens, thousands of infected systems could simultaneously destroy user data."

Pop quiz, hot shot! A terrorist is holding user data hostage, got enough malware strapped to his chest to blow a data center in half. Now what do you do?

Shoot the hostage.

show 1 reply
wonderfulytoday at 8:55 AM

I'm a victim of this.

In addition to concerns about npm, I'm now hesitant to use the GitHub CLI, which stores a highly privileged OAuth token in plain text in the HOME directory. After the attacker accesses it, they can do almost anything on behalf of me, for example, they turned many of my private repos to public.

show 4 replies
wiradikusumatoday at 4:48 AM

Does anyone know why NPM seems to be the only attractive target? Python and Java are very popular, but I haven't heard anything in those ecosystems for a while. Is it because something inherently "weak" about NPM, or simply because, like Windows or JavaScript, everyone uses it?

show 8 replies
dawnerdtoday at 8:25 AM

Everyone is blaming npm but GitHub should be put on blast too for allowing the repos to be created and not quickly flagged.

GitHub has a massive malware problem as it is and it doesn’t get enough attention.

show 4 replies
efortistoday at 10:19 AM

Mitigate this attack vector by adding:

    ignore-scripts=true
to your .npmrc

https://blog.uxtly.com/getting-rid-of-npm-scripts

show 4 replies
thepasswordapptoday at 5:00 AM

The credential harvesting aspect is what concerns me most for the average developer. If you've ever run `npm install` on an affected package, your environment variables, .npmrc tokens, and potentially other cached credentials may have been exfiltrated.

The action item for anyone potentially affected: rotate your npm tokens, GitHub PATs, and any API keys that were in environment variables. And if you're like most developers and reused any of those passwords elsewhere... rotate those too.

This is why periodic credential rotation matters - not just after a breach notification, but proactively. It reduces the window where any stolen credential is useful.

show 5 replies
arkhtoday at 9:04 AM

Most of those attacks do the same kind of things.

So I'm surprised to never see something akin to "our AI systems flagged a possible attack" in those posts. Or the fact Github from AI pusher fame Microsoft does not already use their AI to find this kind of attacks before they become a problem.

Where is this miracle AI for cybersecurity when you need it?

show 3 replies
mrkloltoday at 8:58 AM

Is there any reason to keep using postinstall scripts allowed instead of asking e.g. the user? Are they even needed in most cases?

show 1 reply
Aeoluntoday at 6:14 AM

I thought this was a really insightful post, until they used it to try and sell me on Gitlab’s security features.

show 2 replies
newsofthedaytoday at 4:37 PM

As a Java dev, seems like only a matter of time before Maven Nexus repo attacks become commonplace.

show 2 replies
Yokohiiitoday at 9:54 AM

I have an friend that starts an project next month that will rely on npm. He is quite a noob and didn't code in ages. He will have almost no clue how to harden against this, he will probably not even notice if he becomes a victim until something really bad happens.

Pretty sad.

show 2 replies
akdor1154today at 9:32 AM

Jesus Christ, i can't even get my own package to reliably self-publish in CI without ending up with a fragile pile of twigs, I'm awed they are able to automate infection like that.

ksynwatoday at 11:32 AM

What are the "sha1-hulud" github repositories for exactly? I see files like secrets.json but the contents seems to not be valid json. Are these encrypted?

show 1 reply
dmitrygrtoday at 5:43 AM

Lucky for us C programmers. Each distro provides its own trusted libc, and my code has no other dependencies. :)

show 3 replies
xyzaltoday at 8:06 AM

Okay ... what best practices should I as a mere dev follow to be protected? Is the "cooldown" approach enough, or should every npm command be run in bubblewrap ... ?

show 1 reply
austin-cheneytoday at 11:08 AM

Are there any good alternatives to ESLint? ESLint is now my only dev dependency with hundreds of dependencies of its own.

show 1 reply
hakcermanitoday at 1:01 PM

pardon the naive question. What i don't get is these injected payload are js files, isn't there some scanning at npm upload level to look for exfiltration behaviour, bash executions of dangerous commands like rm or shred ?

TZubiriyesterday at 10:24 PM

Not all the npm packages, but always an npm package

show 1 reply
yupyupyupstoday at 1:27 AM

Something helpful here would be to enable developers to optionally identify themselves. Not Discord-style where only the platform knows their real identity, but publically as well.

show 3 replies
ChrisArchitectyesterday at 3:53 PM

Discussion: https://news.ycombinator.com/item?id=46032539

show 1 reply
bn-ltoday at 7:51 PM

Oh look, another day and another NPM supply chain attack.

zx8080today at 10:05 AM

Everyone wanted to centralise as much as possible to save every cent. No wonder what it got us all into.

Enjoy it while saving your cent!

show 1 reply
Barry-Perkinstoday at 1:18 PM

[dead]

Incipienttoday at 12:16 AM

Surely in this day and age we can fairly trivially find out these come from the usual suspects - China, Russia, Iran, etc. Being in such a digital age, where our economies are built on this tech...is this not effectively (economic) warfare? Why are so many governments blase about it?

show 7 replies
AmbroseBiercetoday at 8:53 AM

Microsoft should just bite the bullet and make a huge JS standard library and then send GitHub notifications to all the project maintainers who are using anything that could be replaced by something from there suggesting them to do such replacement. This would likely significantly reduce the number of supply chain attacks on the npm ecosystem.

show 4 replies
hresvelgrtoday at 2:50 PM

While this does appear to be getting worse, I'm in the camp of letting it happen. The Node/JS ecosystem is imho completely unsuitable for serious work and this is merely the natural consequence. Let it burn, and perhaps something better will come from the ashes.