TanStack npm Worm Hit OpenAI and Mistral


OpenAI confirmed two employee devices were compromised through a malicious npm package update. The attackers didn’t find a zero-day vulnerability or guess a weak password. They simply poisoned a trusted dependency that engineers install without a second thought.

The Mini Shai-Hulud worm hit 169 npm packages on May 11, 2026, spreading through TanStack Router, Mistral AI’s SDK, and UiPath’s automation tooling. By the time security teams noticed, the malware had already exfiltrated credentials from GitHub Actions runners, AWS environments, and local developer machines across hundreds of organizations.

AspectKey Point
Attack dateMay 11, 2026
Packages hit169 npm packages, 373 malicious versions
Major targetsTanStack, Mistral AI, UiPath, OpenSearch
Confirmed victimsOpenAI (2 devices), Mistral AI (5GB source code), European Commission

This attack matters for AI engineers specifically because the threat actors explicitly targeted AI company infrastructure. Mistral’s SDK was compromised. OpenAI’s code signing certificates were exposed. The worm propagated itself using stolen credentials to publish more infected packages. If you work in AI and use npm, your supply chain is a target.

How the Attack Worked

The Mini Shai-Hulud worm exploited a misconfiguration in TanStack’s GitHub Actions workflow. A pull request from a forked repository triggered a workflow with write access to the base repository’s cache. The attackers poisoned that cache with malicious code and waited.

When TanStack’s legitimate release pipeline ran, the poisoned cache injected a ~499 KB obfuscated JavaScript file into the published npm tarballs. The packages were signed with TanStack’s trusted OIDC identity, making them indistinguishable from legitimate releases by provenance attestation alone.

The payload executed during npm install through a clever trick. It added itself as an optional dependency with a prepare script: bun run tanstack_runner.js && exit 1. Because optional dependencies can fail without stopping installation, the malicious code had already executed by the time npm treated the dependency as failed.

Once running, the worm scraped tokens directly from the GitHub Actions runner’s memory and exchanged them for npm publish credentials through npm’s token exchange endpoint. It then searched for other packages the victim could publish, injected the malicious dependency, bumped versions, and released new compromised packages automatically.

What the Worm Stole

The payload targeted credentials across every major platform AI engineers use daily:

Cloud infrastructure: AWS credentials, instance metadata tokens, and environment variables pointing to S3 buckets or Lambda configurations.

CI/CD systems: GitHub tokens, Actions OIDC tokens, npm publish tokens, and any secrets exposed in workflow environments.

Container orchestration: Kubernetes service account files and HashiCorp Vault tokens.

Local secrets: 1Password tokens, SSH keys, and configuration files in developer home directories.

For OpenAI specifically, the attackers gained unauthorized access to internal source code repositories containing signing certificates for iOS, macOS, and Windows products. While OpenAI confirmed no user data or production systems were compromised, the exposure of code signing certificates represents a serious supply chain risk. Apps signed with those certificates could be trusted by operating systems until revocation.

Why AI Companies Are Prime Targets

AI labs operate differently from traditional software companies in ways that make them attractive targets for supply chain attacks.

Fast-moving development cycles: AI teams ship rapidly. When a model improvement drops, engineers rush to integrate it. Speed creates pressure to skip security reviews on dependency updates.

Heavy reliance on open source: AI engineering stacks depend on hundreds of npm and PyPI packages for everything from data processing to API clients. Each dependency is a potential entry point.

High-value targets: AI company source code, model weights, and training data have immense value. The Mistral AI extortion demand (asking $25,000 for 5GB of internal code) shows attackers understand this.

Interconnected ecosystems: AI companies publish SDKs that developers worldwide install. Compromising Mistral’s official SDK means every downstream user becomes a potential victim.

Through implementing AI agent systems at scale, I’ve seen how integration complexity compounds security risks. Every API client, every SDK, every utility library adds surface area. The TanStack attack demonstrates that attackers are mapping these dependencies and targeting the points where trust is highest.

Immediate Actions for AI Engineers

If you installed any TanStack packages between May 11 and May 15, 2026, you need to audit your systems now.

Check your lockfiles: Run npm ls @tanstack/router @tanstack/react-router @tanstack/query and verify the versions against the known safe versions published after May 15. If you pulled packages during the attack window, assume compromise and rotate credentials.

Rotate everything: GitHub personal access tokens, npm tokens, AWS access keys, any secrets that were present on the machine during npm install. The worm specifically targeted CI environments, so any credentials exposed to GitHub Actions workflows should be considered stolen.

Audit your CI/CD: Review GitHub Actions logs for the attack window. Look for unexpected npm publish events, cache poisoning indicators, or outbound network connections to unfamiliar domains during install phases.

Update macOS apps: If you use OpenAI’s ChatGPT Desktop, Codex App, or Codex CLI, update immediately. The old signing certificates will be revoked on June 12, 2026, and unsigned apps will be blocked by macOS.

Long-Term Supply Chain Security

The TanStack attack exploited a class of vulnerability that affects every project using GitHub Actions with npm publishing. Fixing this requires changes to how AI engineering teams handle dependencies.

Pin dependencies strictly: Use exact version locks rather than semantic version ranges. The ^ and ~ prefixes that allow automatic minor updates are exactly what let compromised packages flow into downstream projects.

Verify package integrity: Check that packages match expected checksums before installation. Tools like npm’s --verify-signatures flag can detect packages that were tampered with after signing.

Isolate CI/CD credentials: The worm harvested tokens from GitHub Actions runner memory. Use just-in-time token provisioning rather than persistent secrets. Scope tokens to the minimum permissions needed for each workflow step.

Monitor for anomalies: Unexpected version bumps, new maintainers, or sudden changes in package size are red flags. The compromised TanStack packages were ~499 KB larger than normal due to the obfuscated payload.

For teams building production AI applications, supply chain security is now as critical as model security. The same attackers targeting npm packages today will target model registries and fine-tuning datasets tomorrow.

The Broader Pattern

Mini Shai-Hulud isn’t a one-off incident. The same threat actor (TeamPCP) executed similar attacks against the SAP developer ecosystem in April 2026 and hit AntV packages just days after the TanStack compromise. Security researchers have documented the worm’s evolution across campaigns, with each iteration adding new credential theft capabilities and propagation techniques.

The attack’s sophistication stands out. Publishing malicious packages that pass provenance attestation checks, using trusted OIDC identities, and weaponizing victims’ own publish access to spread further represents a new level of supply chain threat. Traditional security measures like code signing and provenance verification weren’t enough because the attacker operated through legitimate infrastructure.

For AI engineers, this means the threat model has shifted. You can’t trust a package simply because it comes from a known namespace, has valid signatures, and was published through official CI/CD pipelines. The entire chain from code review to artifact storage needs scrutiny.

Frequently Asked Questions

How do I check if I’m affected by the TanStack attack?

Run npm ls @tanstack/router @tanstack/react-router @tanstack/query and check if you have versions published between May 11 and May 15, 2026. If so, rotate all credentials that were accessible to npm during install, including environment variables, GitHub tokens, and cloud credentials.

Did the attackers access AI models or training data?

OpenAI confirmed the breach was limited to code repositories accessible by two employees. No production systems, user data, or model weights were compromised. Mistral AI has not publicly confirmed the scope of their exposure, though TeamPCP claimed access to 5GB of source code.

Why did npm provenance attestation fail to prevent this?

The attackers compromised TanStack’s CI/CD pipeline and published packages using TanStack’s legitimate OIDC identity. From npm’s perspective, the packages had valid provenance because they genuinely came from the authorized publishing workflow. The vulnerability was upstream in the GitHub Actions cache poisoning.

Sources

To see exactly how to implement secure AI systems in practice, watch the full video tutorials on YouTube.

If you’re building production AI applications and want to understand security threats like this one, join the AI Engineering community where we discuss real-world implementation challenges including supply chain security, credential management, and CI/CD hardening.

Inside the community, you’ll find engineers who’ve dealt with these attacks firsthand sharing their audit processes and prevention strategies.

Zen van Riel

Zen van Riel

Senior AI Engineer | Ex-Microsoft, Ex-GitHub

I went from a $500/month internship to Senior AI Engineer. Now I teach 30,000+ engineers on YouTube and coach engineers toward six-figure AI careers in the AI Engineering community.

Blog last updated