The Largest Supply Chain Attack Ever Just Infected Go

BBetter Stack
Computing/SoftwareInternet Technology

Transcript

00:00:00The NPM worm that everyone scrambled to fight last year just did something completely new,
00:00:04it jumped ecosystems and it's now showing up in Go packages. And the nasty part is how it's
00:00:09actually getting in, it's planting malicious hooks into things like your clawed code setup
00:00:13and your VS code tasks. Today we're going to cover three things, a recap of what the worm
00:00:18actually is, a breakdown of what changed in this new wave and a list of things that you can do
00:00:23today to stay secure. And we've covered the NPM supply chain attack several times on this channel
00:00:28so subscribe to BetterStack if you don't want to miss an important update.
00:00:36If you missed it the first time, Shai Halud is a self-replicating worm that lives in package
00:00:41registries. Here's how it works, you install a poison package, it runs on install and then scans
00:00:47your machine for secrets. It's looking for things like NPM tokens, GitHub tokens, AWS, GCP and Azure
00:00:54keys, SSH keys. It even runs Trufflehog, a tool designed to protect organizations by finding exposed
00:01:01keys so you can rotate them. But in this case it's being used maliciously so the attacker can grab
00:01:06those secrets for themselves. Then it uses your stolen NPM tokens to publish poisoned versions of
00:01:12your NPM packages which infects the next person meaning there's no attacker in the loop. It spreads
00:01:18automatically and that's why it's called a worm and not just malware. It first hit in September 2025
00:01:24then came back bigger in November and in 2026 a group calling themselves Team PCP open sourced the
00:01:31whole thing and ran a contest for the biggest attack so now there are copycat waves constantly. Now there's
00:01:38a brand new wave which the security firm Socket.dev flagged at the end of June and two things are
00:01:43different. First off it jumped ecosystems. It didn't just appear in another NPM package it actually appeared
00:01:49in a Go module called the Varana blockchain project. But this is not actually infecting Go packages
00:01:55directly nothing in Go's tooling actually ran it. What actually shipped was a source archive with a bunch
00:02:01of JavaScript files hidden within it. It contained a .clawed folder and a .vscode folder to execute code as hooks
00:02:08when other commands are run. There's a settings.json with a .clawed code session start hook and also a
00:02:14tasks.json with a .vscode folder open task that runs node.clawed.setup.mjs so the malware can fire
00:02:22the moment you open a folder or start a coding session. From there it decodes and stages its
00:02:27real payload through BUN. It grabs your .m file and then every credential it can find and even checks if
00:02:34you're running things like CrowdStrike, Defender and Sentinel-1 before it goes to work. Just sit with
00:02:39that for a second. Your ignore scripts flag no longer works because no install scripts run and
00:02:45npm uninstall no longer works because the malicious code doesn't live in your node modules. It now lives
00:02:51in your project config. For years the advice has been to watch your dependencies but now the target has
00:02:56moved. It's not your app's dependencies anymore it's the dev environment itself. And if you don't notice
00:03:01you could be pushing malicious code to production to run in CI environments like GitHub workflows. So of
00:03:08course that all sounds terrifying but here are the things you can actually do today to remain safe and
00:03:13secure. Don't just lean on the ignore scripts flag as your safety net that only covers install hooks and
00:03:18this new wave sidesteps that completely. Treat Claude, VS Code and GitHub workflows as executable code because
00:03:26they are. When you clone a repo or pull a dependency source actually look at those files before you open
00:03:31your project in your coding editor. Three is in VS Code keep automatic tasks turned off. That's the task
00:03:38manage automatic tasks command so a folder open task can't run without you saying yes. Four is to use short-lived
00:03:45and least privileged tokens and relying on things like OIDC rather than having long-lived tokens in your environment.
00:03:52If a token can't be stolen and reused then that means the worm can't replicate through you. And
00:03:58five is in your CI to put egress filtering on your runners so if some malicious code does execute it at
00:04:04least cannot send those credentials to the attacker. And for those not familiar using GitHub as an example
00:04:10CI, egress refers to sending data out of GitHub's networks so you would set up a whitelist and only allow
00:04:16a request to go to where you permit. This would stop the malicious code in its tracks.
00:04:20Now I know all of this sounds pretty terrifying
00:04:22but if we all just follow best practices like setting a minimum release age in NPMRC,
00:04:27only using short-lived tokens,
00:04:29disabling automatic hooks and storing sensitive data in things like password managers,
00:04:34then we're far less likely to fall victim. If you want to learn more about security then we've just released a video
00:04:40covering a free alternative to Burp Suite. I've been Warren from BetterStack,
00:04:45thanks for watching and I'll see you in the next one!

Key Takeaway

The Shai Halud worm has evolved to infect developer environments through project configuration files like .vscode and .clawed, rendering traditional npm install-time security measures ineffective.

Highlights

  • The Shai Halud malware now executes malicious code within local developer configuration files, including .vscode and .clawed folders, rather than relying on standard dependency installation hooks.

  • This new infection wave targets the developer environment directly by embedding JavaScript hooks that trigger automatically when a project folder opens or a coding session starts.

  • Malicious code in this wave bypasses standard security protections like npm ignore-scripts by residing in project settings rather than node_modules.

  • The worm exfiltrates local credentials, including NPM tokens, GitHub tokens, AWS, GCP, and Azure keys, and SSH keys after verifying the absence of security software like CrowdStrike or Defender.

  • Developers can mitigate risks by disabling automatic VS Code tasks, using short-lived OIDC tokens, and implementing egress filtering on CI/CD runners to prevent unauthorized data transmission.

Timeline

The Evolution of Shai Halud

  • Shai Halud is a self-replicating worm that steals credentials from developer machines.
  • The malware scans for NPM, GitHub, AWS, GCP, Azure, and SSH keys using the tool Trufflehog.
  • Infected packages publish new, poisoned versions of themselves using stolen tokens to spread automatically.
  • Team PCP open-sourced the malware in 2026, leading to a surge in copycat attacks.

This worm automates the entire lifecycle of a supply chain attack by identifying local credentials and immediately using them to publish malicious updates. By removing the need for an attacker to remain in the loop, it spreads rapidly across registries. The transition to an open-sourced toolkit has significantly increased the frequency and variety of these attacks.

New Infection Vectors in Go and Developer Configs

  • The latest wave uses a Go module for the Varana blockchain to hide malicious source archives.
  • Malware executes via .vscode/tasks.json and .clawed/settings.json hooks upon folder access.
  • The payload bypasses npm ignore-scripts by running from configuration files rather than node_modules.
  • Infected machines can push malicious code into production via automated CI environments.

The attack now targets the development environment rather than just application dependencies. By embedding scripts directly into IDE configuration files, the malware fires as soon as a developer opens their editor. This technique circumvents long-standing security practices that rely solely on monitoring package installation scripts.

Mitigation and Security Best Practices

  • Developers must treat IDE and editor configuration files as executable code.
  • Disabling automatic tasks in VS Code prevents unauthorized execution when opening folders.
  • Using short-lived OIDC tokens limits the blast radius of stolen credentials.
  • Implementing egress filtering on CI/CD runners prevents malware from transmitting stolen data to external servers.

Effective defense requires moving beyond dependency monitoring to securing the broader development ecosystem. Strategies include vetting cloned repository configurations, restricting token lifespans, and strictly controlling network access within CI/CD pipelines. These measures ensure that even if an environment is compromised, the attacker cannot successfully exfiltrate credentials or replicate the infection.

Community Posts

View all posts