[フレーム]

NPM Attack Exposes Supply Chain Risks in Open Source Software

4 - 8 min read Sep 18, 2025

An attack against the npm ecosystem compromised 18 widely used packages — libraries downloaded more than 2.6 billion times each week. The malicious versions were uploaded through a maintainer account compromise, turning trusted dependencies into a malware download pipeline.

This wasn’t limited to JavaScript developers. Because npm packages run inside containers and Linux servers, the blast radius extended far beyond web projects. The incident underscores a hard truth: if the npm registry can be poisoned, any open-source registry is vulnerable.

What is npm and Why It Matters to Linux

npm is the largest package manager for JavaScript and Node.js, serving millions of developers who pull libraries daily from the npm registry. These aren’t fringe utilities. Packages like chalk, debug, and ansi-styles are core building blocks in open-source software. They colorize logs, handle debugging, and support frameworks that power production systems.[画像:Npm Registry Malware Download Injected Esm W400][画像:Npm Registry Malware Download Injected Esm W400][画像:Npm Registry Malware Download Injected Esm W400]

In Linux environments, npm libraries are bundled into pipelines, containers, and workloads that almost always run on Linux. When a trusted package gets compromised, the impact doesn’t stop with developers on laptops — it cascades into Linux servers, Kubernetes clusters, and CI/CD environments that rely on npm every day.

History backs this up. npm flaws have carried downstream into distributions themselves. Ubuntu, for example, issued Ubuntu: 6643-1 Moderate: Node-IP SSRF Risk Exposing Information when an npm package vulnerability created exposure inside the distro’s ecosystem. This is part of the broader risks highlighted in the open source software supply chain security.

That’s why a compromise in the npm registry isn’t a web developer’s problem alone. It’s an open-source supply chain issue that affects Linux at the core — the servers, workloads, and production environments organizations depend on.

How npm Packages Were Compromised in the Attack

Malicious updates were uploaded to the npm registry after attackers gained control of a maintainer account. The registry itself wasn’t breached. The compromise came from a phishing campaign against a well-known maintainer who publishes several popular libraries. Going by the handle qix, the maintainer was tricked into sharing two-factor credentials with an attacker posing as npm support.

With access in hand, the attackers injected malicious code into trusted packages, including chalk, debug, and ansi-styles. Because those libraries sit at the base of so many open-source projects, any automated build pipeline, often running on Linux servers, could have pulled in the poisoned code without warning. The poisoned versions stayed up for about two hours — long enough to slip into production builds.

This technique wasn’t limited to phishing, across ecosystems. A recent supply chain attack targeting Telegram bots shows how easily attackers can adapt these methods across platforms. Once a maintainer account is compromised or a dependency is poisoned, the malicious update doesn’t stop at development — it spreads into CI/CD pipelines and production environments at scale.

Technical Breakdown of the Injected Malware

The injected malware followed a five-stage sequence, designed for stealth and long-term impact:

Stage 1 — Injection into Browser APIs

The malicious code hooked common browser entry points like fetch, XMLHttpRequest, and wallet APIs such as window.ethereum. By intercepting these functions, attackers gained direct access to application traffic and wallet interactions. Since Node.js apps often bundle front-end tooling from the npm registry, this interception could flow downstream into Linux-hosted services.

Stage 2 — Monitoring for Wallet ActivityNpm Injected Wallet Monitoring Esm W400Npm Injected Wallet Monitoring Esm W400Npm Injected Wallet Monitoring Esm W400

Network responses and DOM data were scanned for wallet addresses and transaction payloads across Ethereum, Solana, Bitcoin-like chains, and others. This wasn’t passive logging — it was active surveillance waiting for the precise moment a transfer was initiated.

Stage 3 — Rewriting Transaction Targets

Once a wallet address was detected, the code silently swapped it for one controlled by the attacker. Often, the replacement used a visually similar address to evade notice. Because the swap occurred before the signing prompt, the UI still displayed expected values while the actual transaction routed funds elsewhere.

Stage 4 — Hijacking Before Signing

For EVM-style chains, the payload manipulated recipients, amounts, or allowance fields just before signing. Automated signing flows in CI systems or headless Linux environments were especially vulnerable, as they could approve poisoned transactions without human review.

Stage 5 — Stealth and Persistence

The malware minimized detection: avoiding alerts, cleaning traces, and persisting across sessions. It could delay activation or perform environment checks to evade sandboxes. A single malicious npm install could therefore establish a long-term malware download risk.

Affected npm Packages and Versions

Eighteen npm packages were compromised, including core utilities like chalk and debug. Together, they see over 2.6 billion weekly downloads. That’s enough for one poisoned release to spread through open-source stacks and into Linux production.

Package

Compromised Version

Notes

ansi-styles

6.2.2

Core styling utility

debug

4.4.2

Widely used logging lib

chalk

5.6.1

Common CLI color package

supports-color

10.2.1

Terminal detection

strip-ansi

7.1.1

Removes ANSI codes

Other compromised libraries included ansi-regex, wrap-ansi, color-convert, color-name, slice-ansi, color, color-string, simple-swizzle, supports-hyperlinks, has-ansi, chalk-template, backslash, and is-arrayish.

For sysadmins, the risk comes from transitive dependencies that let poisoned releases slip through unnoticed. A single update in the npm registry can move downstream into build systems, container images, and eventually Linux servers in production — the exact environments organizations trust to stay stable.

Supply Chain Risks Beyond npm: The Linux Parallel

This npm attack shows why supply chain compromises are so effective: attackers don’t go after applications directly — they poison trusted dependencies upstream. It’s like tampering with brake pads at the factory instead of cutting brakes after a car is sold. Once malicious code is injected into a widely used package on the npm registry, it rides downstream into thousands of projects automatically.

The risk isn’t limited to npm. Linux package managers like APT, RPM, and pacman rely on the same trust in upstream maintainers. A compromised dependency in those ecosystems could spread just as quickly.

For open source, the warning is clear: even a single poisoned dependency can spread widely across dependent projects and networks — a fact that IBM observed when studying how supply chain vulnerabilities escalate across large vendor ecosystems.

How This Attack Compares to Past Incidents

This npm compromise wasn’t the first supply chain attack to exploit upstream trust.

  • Dependency confusion campaigns have already targeted Amazon and Slack, slipping poisoned packages into build pipelines.

  • A Telegram bot supply chain attack used similar phishing tactics to compromise maintainer accounts.

  • Even Linux distributions have been exposed — Ubuntu issued 6643-1 Node-IP SSRF Risk after an npm dependency vulnerability.

  • The CHAOS RAT in AUR incident showed the same kind of upstream trust failure: three packages posing as browser tools were uploaded on July 16, 2025, delivered remote-access malware, and weren’t removed until two days later.

As outlined in evaluating an open source security baseline, these cases all point to the same weakness: ecosystems rely on a handful of maintainers, and when trust in those accounts is broken, the fallout spreads far beyond a single project.

What Developers and Linux Admins Should Do Now

Immediate Steps (triage)

Audit projects and servers:

npm ls chalk debug ansi-styles
  • Pin safe versions and rebuild:
    npm install chalk@5.6.0 --save-exact
  • Rebuild containers and scan with tools like Trivy or Grype.

Audit & Prevention

  • Run audits (npm audit, yarn audit).
  • Generate and scan SBOMs with Syft + Grype, following NIST supply chain risk management guidance.
  • Use npm ci and lockfiles in CI/CD.
  • Require 2FA and rotate credentials.
  • Verify package integrity with checksums (what are checksums and why you should be using them).

Ongoing Security

The takeaway here is straightforward: detection and response matter, but prevention is critical. Securing the supply chain around npm and Linux workloads means assuming that any dependency can be compromised and building safeguards before the attack lands.

Implications for Open Source and Linux Security

The npm attack makes the trust problem clear: popularity does not equal safety. Millions of downloads each week do not make a package safe.

The same risk model applies outside npm. PyPI, RubyGems, and Linux distribution repositories all rely on upstream maintainers and community oversight. A single poisoned dependency in any of those registries can cascade into production workloads just as easily as a malicious release in the npm registry.

Closing Takeaway: npm Supply Chain Risks at Scale

The npm supply chain attack shows how quickly trust in open source can be turned against the community. A single injected update was enough to create a malware download pipeline that reached millions of developers in hours.

For Linux and OSS users, one poisoned npm package can ripple through pipelines, containers, and production systems at scale. When npm breaks, the internet feels it — and the same is true for every open-source registry.

Get the Latest News & Insights

Sign up to get the latest security news affecting Linux and open source delivered straight to your inbox.

Please enable the javascript to submit this form " name="Submit" onclick="if (!window.__cfRLUnblockHandlers) return false; try{ return submitAcymForm('subscribe','formAcym27411', 'acymSubmitSubForm'); }catch(err){alert('The form could not be submitted '+err);return false;}" data-cf-modified-18d40ab4c25223d5d9ba86c6-="" />
© 2024 Guardian Digital, Inc All Rights Reserved
You are now being logged in using your Facebook credentials

AltStyle によって変換されたページ (->オリジナル) /