Loading
NPM Supply Chain Attack Exposed main
Web & cybersecurityBy SDX Development

Share this article

A software supply chain attack led to 84 malicious versions of 42 TanStack packages being published on npm. A few days later, a compromised GitHub account was used to clone approximately 170 private CrowdSec repositories. The incident shows how a JavaScript dependency can expose far more than the contents of node_modules.

In brief

One compromised dependency, much broader access

The malicious code could search for GitHub and npm tokens, SSH keys, and secrets linked in particular to AWS, Google Cloud, Kubernetes, or HashiCorp Vault. CrowdSec links the incident to the cloning of approximately 170 private repositories.

How were 42 TanStack packages compromised?

The incident was not caused by the simple theft of an npm password. TanStack used GitHub Actions and the OIDC Trusted Publishing mechanism, designed to avoid storing a permanent npm token in repository secrets.

During a release, the authorized workflow obtains a short-lived token to communicate with npm. This architecture reduces the risks associated with persistent credentials, but it does not automatically protect against the compromise of the process requesting the token.

According to TanStack’s post-mortem, a GitHub Actions workflow using pull_request_target could execute code from an external pull request while interacting with a shared cache. The attacker reportedly exploited this configuration to poison a cache that was later restored by a legitimate release workflow.

The injected code could then execute in the release environment and retrieve the OIDC token intended for npm from memory. This token was used to publish the malicious versions under the project’s legitimate identity.

Diagram of the attack chain that compromised the TanStack packages
From GitHub Actions cache poisoning to the publication of malicious versions on npm.
Key point

npm was not compromised as a whole

The packages were distributed from the official registry, but their publication was authenticated through the identity associated with TanStack. The release workflow had not been modified, and no permanent npm token was reportedly stolen.

On May 11, 2026, two malicious versions were published for each of the 42 affected @tanstack/* packages, for a total of 84 versions. TanStack says it quickly deprecated and then removed them from the registry.

What did the malicious code do?

The compromised versions contained an obfuscated JavaScript file of approximately 2.3MB, executed during installation. According to the security advisory published by TanStack and GitHub, it searched for several categories of secrets accessible from the workstation or continuous integration environment.

Development identities

GitHub, npm, and SSH keys

The malware could search for various GitHub and npm tokens, the contents of .npmrc files, and private SSH keys.

Cloud and infrastructure

AWS, Google Cloud, Kubernetes, and Vault

Information available in environment variables or local files could also be targeted and exfiltrated.

The code also had a propagation mechanism. When it found a package maintainer’s npm credentials, it could search for the other packages associated with that account and attempt to republish them with the same malicious content.

The risk therefore does not depend on the data contained in the package itself. It primarily depends on the resources accessible to the process executing its installation script. On a development workstation or in CI, this scope may include private repositories, cloud services, and deployment environments.

From an npm package to CrowdSec’s private repositories

On September 16, 2026, CrowdSec discovered that an archive containing code from its GitHub organization had been published on a forum. The company launched an investigation with GitHub to trace the OAuth token used to download the repositories.

According to CrowdSec, the token belonged to the account of a developer who had recently left the company. Some access had already been revoked, but the account remained in the GitHub organization to complete work in progress. The developer’s workstation was reportedly compromised by the attack targeting the TanStack packages.

On May 22, this account was reportedly used to clone approximately 170 private GitHub repositories. Its access was removed on May 25, before CrowdSec became aware of the cloning. The archive only became public several months later.

A significant but contained scope, according to CrowdSec

CrowdSec says it found no modification to its repositories or alteration of its build pipelines or code. The company also states that its databases and infrastructure were not compromised: the account was reportedly used only to clone the repositories.

However, the leak included private code, some email addresses, and several secrets present in the repositories. CrowdSec specifically mentions an AWS token linked to the SNS service that remained usable, but whose limited permissions reportedly prevented it from exceeding its intended scope.

Defense in depth

Least privilege limits the blast radius

Preventing an identity from having excessive rights does not always stop the initial compromise. However, this separation can prevent an exposed token from modifying infrastructure, repositories, or the most sensitive data.

01

Limit each identity to its function

A token intended to publish notifications should not be able to administer infrastructure, read databases, or modify code repositories.

02

Separate read and modification access

Read access can already cause a significant leak, but the absence of write permissions reduces the risk of sabotage, code injection, or propagation.

03

Reduce access duration and scope

Short-lived tokens, permissions limited to a resource, and rapid revocation reduce the period during which an exposed secret remains usable.

Least privilege does not replace workstation protection or identity monitoring. It provides a containment layer: when a first barrier fails, the remaining permissions determine how far the attacker can go.

Why web developers are particularly affected

A development workstation often concentrates numerous privileges. It may be connected simultaneously to GitHub, npm, a hosting provider, several cloud services, SSH servers, databases, and pre-production environments.

At the same time, this workstation regularly installs code from hundreds or even thousands of direct and indirect dependencies. Some packages have scripts that run automatically during installation.

An npm install command therefore does not merely download JavaScript files. It can execute code with the permissions of the user or CI process that launched it. An attack on npm can thus become a GitHub, cloud, or CI/CD incident.

How can you check whether a project was exposed?

The attack took place on May 11, 2026. TanStack says the malicious versions were detected, deprecated, and then removed, and that the versions currently available are considered safe. A team using TanStack must nevertheless check whether an affected version was resolved and executed during the relevant period.

01

Check the versions actually installed

The package.json file is not always sufficient. You must examine package-lock.json, pnpm-lock.yaml, or yarn.lock, then compare the versions with the list published in advisory GHSA-g7cv-rxg3-hmpx.

02

Inventory accessible secrets

If a compromised version was executed, deleting the package is not enough. GitHub, npm, or cloud tokens, SSH keys, and CI/CD secrets accessible to the environment must be considered potentially exposed.

03

Renew credentials from a clean environment

Secret rotation should ideally be performed from a workstation considered trustworthy, so that the new credentials are not immediately exposed.

04

Review logs over time

GitHub, AWS, Google Cloud, and other platform logs should be analyzed beyond the time of installation. In the CrowdSec case, the cloning reportedly occurred eleven days after the malicious packages were published.

TanStack’s advisory states that an installation with npm, pnpm, or Yarn could trigger the payload when an affected version was resolved. Any environment that executed one of these versions should therefore be treated as potentially compromised.

Six measures to reduce supply chain risk

Best practices for securing npm dependencies and GitHub Actions workflows
The main controls to apply to dependencies, workflows, caches, and technical identities.

Strengthen dependencies, workflows, and identities

  1. Pin versions and monitor unexpected changes in lockfiles.
  2. Audit GitHub Actions workflows, particularly those using pull_request_target.
  3. Separate caches between external contributions and trusted release processes.
  4. Limit permissions for each token, account, service, and workflow to what is strictly necessary.
  5. Monitor installations and retain logs that make it possible to trace unusual operations.
  6. Remove access quickly for collaborators who leave the organization or no longer need it.

TanStack says it strengthened its workflows, their permissions, cache management, and the pinning of certain GitHub Actions after the incident. The case shows that files located in .github/workflows are fully part of a project’s security infrastructure.

Control access retained after departure

Temporarily retaining access may address an operational constraint, but this exception should remain explicit, time-limited, and monitored. An identity that is rarely used remains exploitable if its workstation, session, or tokens are compromised.

Should you stop using TanStack or npm?

No. TanStack published a post-mortem, removed the affected versions, and implemented several security changes. As of May 15, the project stated that the versions then available were safe to install.

The incident also does not mean that npm is inherently dangerous. JavaScript applications necessarily rely on third-party libraries. Rewriting every component would not eliminate the risk and could introduce other vulnerabilities.

The response is instead to treat dependencies, installation scripts, and the pipelines that handle them as a complete part of the attack surface.

A dependency is more than code

Common practices often focus on known vulnerabilities and regularly updating packages. Supply chain attacks add another question: what happens if the new version itself becomes the attack vector?

In this scenario, installing the latest version is no longer automatically protective. Security relies on several layers: version control, analysis of new dependencies, permission separation, workstation protection, publication monitoring, and the ability to renew secrets quickly.

The npm risk extends far beyond node_modules

The incident was not limited to the 42 packages published on npm. A compromised dependency could search for information in a development environment. According to CrowdSec’s investigation, one of the access credentials exposed in this way was then reportedly used to clone approximately 170 private GitHub repositories.

The malicious file may be located in node_modules, but its actual target may be GitHub, the cloud, CI/CD, or any other service accessible from the developer’s workstation.

Before installing a dependency, the question is therefore no longer simply whether it works. You must also determine what it could access if it became malicious. This scope determines the real impact of a compromise.

Sources and methodology Verified on September 19, 2026

This summary is based on the official post-mortem published by TanStack, GitHub security advisory GHSA-g7cv-rxg3-hmpx, and the incident report published by CrowdSec on September 18, 2026.

  • TanStack — Postmortem: npm supply-chain compromise: confirmation of the 84 malicious versions distributed across 42 packages, description of the GitHub Actions, cache, and OIDC chain, and the measures taken after the incident.
  • GitHub — GHSA-g7cv-rxg3-hmpx: list of affected packages and versions, behavior attributed to the malware, and remediation recommendations.
  • CrowdSec — TanStack Supply Chain Attack Analysis: report tracing the GitHub account compromise, the cloning of approximately 170 private repositories, and the analysis of the impact reported by CrowdSec.

WEB & CYBERSECURITY

Build a reliable web foundation before an incident.

Code, dependency and sensitive-path audits turn a technical alert into a controlled action plan.

  • Clear priorities and risks
  • Tested fixes with a rollback plan
  • Long-term maintenance