Postmortem: TanStack npm supply-chain compromise

Lobsters Hottest News

Summary

Detailed postmortem of a supply-chain attack on TanStack's npm packages involving cache poisoning, OIDC token extraction, and credential harvesting malware. All affected versions deprecated; users advised to rotate credentials.

<p><a href="https://lobste.rs/s/d8iunk/postmortem_tanstack_npm_supply_chain">Comments</a></p>
Original Article
View Cached Full Text

Cached at: 05/12/26, 01:19 PM

# Postmortem: TanStack npm supply-chain compromise | TanStack Blog Source: [https://tanstack.com/blog/npm-supply-chain-compromise-postmortem](https://tanstack.com/blog/npm-supply-chain-compromise-postmortem) *by Tanner Linsley on May 11, 2026\.* **Last updated:**2026\-05\-11 On 2026\-05\-11 between 19:20 and 19:26 UTC, an attacker published 84 malicious versions across 42@tanstack/\*npm packages by combining: thepull\_request\_target"Pwn Request" pattern, GitHub Actions cache poisoning across the fork↔base trust boundary, and runtime memory extraction of an OIDC token from the GitHub Actions runner process\. No npm tokens were stolen and the npm publish workflow itself was not compromised\. The malicious versions were detected publicly within 20 minutes by an external researcherashishkurmiworking forstepsecurity\. All affected versions have been deprecated; npm security has been engaged to pull tarballs from the registry\. We have no evidence of npm credentials being stolen, but we strongly recommend that anyone who installed an affected version on 2026\-05\-11 rotate AWS, GCP, Kubernetes, Vault, GitHub, npm, and SSH credentials reachable from the install host\. **Tracking issue:**[TanStack/router\#7383](https://github.com/TanStack/router/issues/7383)**GitHub Security Advisory:**[GHSA\-g7cv\-rxg3\-hmpx](https://github.com/TanStack/router/security/advisories/GHSA-g7cv-rxg3-hmpx) ### Packages affected 42 packages, 84 versions \(two per package, published roughly 6 minutes apart\)\. See the tracking issue for the full table\. Confirmed\-clean families:@tanstack/query\*,@tanstack/table\*,@tanstack/form\*,@tanstack/virtual\*,@tanstack/store,@tanstack/start\(the meta\-package, not@tanstack/start\-\*\)\. ### What the malware does When a developer or CI environment runsnpm install,pnpm install, oryarn installagainst any affected version, npm resolves the maliciousoptionalDependenciesentry, fetches the orphan payload commit from the fork network, runs itspreparelifecycle script, and executes a ~2\.3 MB obfuscatedrouter\_init\.jssmuggled into the affected tarball\. The script: - Harvests credentials from common locations: AWS IMDS / Secrets Manager, GCP metadata, Kubernetes service\-account tokens, Vault tokens,~/\.npmrc, GitHub tokens \(env,ghCLI,\.git\-credentials\), SSH private keys - Exfiltrates over the Session/Oxen messenger file\-upload network \(filev2\.getsession\.org,seed\{1,2,3\}\.getsession\.org\) — end\-to\-end encrypted with no attacker\-controlled C2, so blocking by IP/domain is the only network mitigation - Self\-propagates: enumerates other packages the victim maintains viaregistry\.npmjs\.org/\-/v1/search?text=maintainer:<user\>and republishes them with the same injection Because the payload runs as part of npm install's lifecycle, anyone who installed an affected version on 2026\-05\-11 must treat the install host as potentially compromised\. --- All times UTC\. Local timestamps from GitHub API and npm registry\. ### Pre\-attack \(cache poisoning phase\) TimeEvent2026\-05\-10 17:16Attacker creates fork[github\.com/zblgg/configuration](https://github.com/zblgg/configuration)\(a fork of TanStack/router, deliberately renamed to evade fork\-list searches\)2026\-05\-10 23:29Malicious commit65bf499d16a5e8d25ba95d69ec9790a6dd4a1f14authored on the fork by fabricated identityclaude <claude@users\.noreply\.github\.com\>\. Addspackages/history/vite\_setup\.mjs\(a ~30,000\-line bundled JS payload\)\. Commit message prefixed with\[skip ci\]to suppress CI on the push event2026\-05\-11 ~10:49PR \#7378 opened againstTanStack/router\#maintitled "WIP: simplify history build" byzblgg2026\-05\-11 10:49 onwardsbundle\-size\.ymlandlabeler\.yml\(bothpull\_request\_target\) auto\-run for the PR — no first\-time\-contributor approval required becausepull\_request\_targetbypasses that gate\.pr\.yml\(which usespull\_request\) does NOT run, blocked pending approval that never came2026\-05\-11 11:01–11:11Multiple force\-pushes byzblggto the PR head, each triggering morepull\_request\_targetruns2026\-05\-11 11:11Force\-push lands65bf499d\(the malicious commit\) on the PR head\.bundle\-size\.yml'sbenchmark\-prjob checks outrefs/pull/7378/merge, runspnpm install\+pnpm nx run @benchmarks/bundle\-size:build— this executesvite\_setup\.mjs2026\-05\-11 11:29Cache entryLinux\-pnpm\-store\-6f9233a50def742c09fde54f56553d6b449a535adf87d4083690539f49ae4da11\(1\.1 GB\) saved to GitHub Actions cache forTanStack/router, scoperefs/heads/main— keyed to match whatrelease\.ymlwill look up on the next push to main2026\-05\-11 11:31Attacker force\-pushes the PR back to current main HEAD \(b1c061af\), making the visible PR a 0\-file no\-op\. PR closed and branch deleted in the same minute\. Cache poison persists\.### Detonation \(publish phase\) TimeEvent2026\-05\-11 19:15Manuel merges PR \#7369 \(Shkumbin'sCSS\.supportsfix\) → push to main triggersrelease\.yml\.Workflow run25613093674starts \(19:15:44\), and fails\. 2026\-05\-11 19:20:39npm registry receives publish for@tanstack/history@1\.161\.9and 41 sibling packages \(~84 versions across 42 packages, but only ~half show this exact second; the remainder come during run \#2\)\. Publish is authenticated via OIDC trusted\-publisher binding forTanStack/router release\.yml@refs/heads/main— but it does not come from the workflow's defined Publish Packages step, which was skipped because tests failed\. It comes from the malware running during the test/cleanup phase, which mints an OIDC token via the workflow'sid\-token: writepermission and POSTs directly toregistry\.npmjs\.org2026\-05\-11 19:20:47Run25613093674completes \(status: failure\)2026\-05\-11 19:16Manuel merges PR \#7382 \(jiti tsconfig paths fix\) → second push to main triggersrelease\.yml2026\-05\-11 19:16:22Workflow run25691781302starts\. Same poisoned cache restored2026\-05\-11 19:26:14npm registry receives publish for the second\-version\-per\-package set \(@tanstack/history@1\.161\.12etc\.\)\. Same OIDC mechanism2026\-05\-11 19:26:20Run25691781302completes \(status: failure\)### Detection and response TimeEvent2026\-05\-11 ~19:50External researcher \(carlini\) opens issue \#7383 with a complete writeup of the maliciousoptionalDependenciesfingerprint and the package list \(initially 14 of the 42\)2026\-05\-11 ~19:50Researcher notifies npm security directly2026\-05\-11 ~20:00Manuel acknowledges in \#7383 — incident response begins2026\-05\-11 ~20:10Manuel removes all other team push permissions on GitHub in case of user machines have been compromised2026\-05\-11 ~20:30Tanner emails[security@npmjs\.com](mailto:[email protected])with full IOC list and request to pull tarballs registry\-side\.Formal malware reports are submitted via npm 2026\-05\-11 ~21:00Comprehensive scan of all 295@tanstack/\*packages confirms scope: 42 packages, 84 versions\.Tanner begins npm deprecation process for all 84 affected packages\. Public Twitter/X/LinkedIn/Bluesky disclosure from @tan\_stack and maintainers 2026\-05\-11 21:30Investigation identifiesbundle\-size\.ymlpull\_request\_targetcache\-poisoning vector and thezblgg/configurationfork\.All cache entries for allTanStack/\*GitHub repositories purged via API\. Hardening PR merged:bundle\-size\.ymlrestructured,repository\_ownerguards added, third\-party action refs pinned to SHAs\. Official GitHub Security Advisory is published, CVE requested --- Three vulnerabilities chained together\. Each is necessary for the attack; none alone is sufficient\. ### 1\.pull\_request\_target"Pwn Request" pattern inbundle\-size\.yml bundle\-size\.ymlranpull\_request\_targetfor fork PRs and, inside that trigger context, checked out the fork's PR\-merge ref and ran a build: ``` on: pull_request_target: paths: ['packages/**', 'benchmarks/**'] jobs: benchmark-pr: steps: - uses: actions/[email protected] with: ref: refs/pull/${{ github.event.pull_request.number }}/merge # fork's merged code - uses: TanStack/config/.github/setup@main # transitively calls actions/cache@v5 - run: pnpm nx run @benchmarks/bundle-size:build # executes fork-controlled code ``` ``` on: pull_request_target: paths: ['packages/**', 'benchmarks/**'] jobs: benchmark-pr: steps: - uses: actions/[email protected] with: ref: refs/pull/${{ github.event.pull_request.number }}/merge # fork's merged code - uses: TanStack/config/.github/setup@main # transitively calls actions/cache@v5 - run: pnpm nx run @benchmarks/bundle-size:build # executes fork-controlled code ``` The author of the workflow attempted a trust split \(thecomment\-prjob is separate frombenchmark\-pr, with a comment in the YAML noting the intent to keepbenchmark\-pr"untrusted with read\-only permissions"\)\. The split is correct in spirit but missed two facts: - actions/cache@v5's post\-job save is not gated bypermissions:\. Cache writes use a runner\-internal token, not the workflowGITHUB\_TOKEN\. Settingpermissions: contents: readdoes not block cache mutation\. - Cache scope is per\-repo, shared acrosspull\_request\_targetruns \(which use the base repo's cache scope\) and pushes to main\. A PR running in the base repo's cache scope can poison entries that production workflows on main will later restore\. ### 2\. GitHub Actions cache poisoning across trust boundaries The maliciousvite\_setup\.mjswas specifically designed to write data into the pnpm\-store directory under a key the legitrelease\.ymlworkflow would compute and look up:Linux\-pnpm\-store\-$\{hashFiles\('\*\*/pnpm\-lock\.yaml'\)\}\. When thebenchmark\-prjob ended,actions/cache@v5's post\-step saved the \(now\-poisoned\) pnpm store to that exact key\. Whenrelease\.ymlnext ran on a push to main, its Setup Tools step restored the poisoned entry — entirely as designed\. This is the class of attack documented by Adnan Khan in 2024\. It's not a TanStack\-specific bug; it's a known GitHub Actions design issue that requires conscious mitigation\. release\.ymldeclaresid\-token: write\(legitimately needed for npm OIDC trusted publishing\)\. When the poisoned pnpm store is restored on the runner, attacker\-controlled binaries are now on disk and get invoked during the build step\. Those binaries: - Locate the GitHub ActionsRunner\.Workerprocess via/proc/\*/cmdline - Read/proc/<pid\>/mapsand/proc/<pid\>/memto dump the worker's memory - Extract the OIDC token \(which the runner mints lazily, in memory, whenid\-token: writeis set\) - Use the token to authenticate POST requests directly toregistry\.npmjs\.org— bypassing the workflow's Publish Packages step entirely This is the same memory\-extraction technique \(and verbatim Python script, with attribution comment\) used in thetj\-actions/changed\-filescompromise of March 2025\. The attacker did not invent novel tradecraft; they recombined published research\. ### Why none alone is enough - pull\_request\_targetalone is fine for trusted operations \(labeling, comments\) - Cache poisoning alone \(e\.g\., from inside an already\-compromised dep\) requires a separate publish vehicle - OIDC token extraction alone requires existing code execution on the runner The chain only works because each vulnerability bridges the trust boundary the others assumed: PR fork code crossing into base\-repo cache, base\-repo cache crossing into release\-workflow runtime, and release\-workflow runtime crossing into npm registry write access\. --- ### How we found out Detection was external\.carliniopened issue \#7383 ~20 minutes after the publish, with full technical analysis\. Tanner received a phone call from Socket\.dev just moments after starting the war room confirming the situation\. ### IOC fingerprints \(for downstream maintainers and security tools\) In any@tanstack/\*package's manifest: ``` "optionalDependencies": { "@tanstack/setup": "github:tanstack/router#79ac49eedf774dd4b0cfa308722bc463cfe5885c" } ``` ``` "optionalDependencies": { "@tanstack/setup": "github:tanstack/router#79ac49eedf774dd4b0cfa308722bc463cfe5885c" } ``` - File:router\_init\.js\(~2\.3 MB, package root, not in"files"\) - Cache key:Linux\-pnpm\-store\-6f9233a50def742c09fde54f56553d6b449a535adf87d4083690539f49ae4da11 - 2nd\-stage payload URLs:https://litter\.catbox\.moe/h8nc9u\.js,https://litter\.catbox\.moe/7rrc6l\.mjs - Exfiltration network:filev2\.getsession\.org,seed\{1,2,3\}\.getsession\.org - Forged commit identity:claude <claude@users\.noreply\.github\.com\>\(note: not the real Anthropic Claude — fabricated GitHub no\-reply email\) - Real attacker accounts:zblgg\(id 127806521\),voicproducoes\(id 269549300\) - Attacker fork:[github\.com/zblgg/configuration](https://github.com/zblgg/configuration)\(fork of TanStack/router renamed to evade fork searches\) - Orphan payload commit \(in fork network\):79ac49eedf774dd4b0cfa308722bc463cfe5885c - Workflow runs that performed the malicious publishes:- [github\.com/TanStack/router/actions/runs/25613093674](https://github.com/TanStack/router/actions/runs/25613093674)\(attempt 4\) - [github\.com/TanStack/router/actions/runs/25691781302](https://github.com/TanStack/router/actions/runs/25691781302) --- ### What went well - External researchers noticed and reported with full technical detail within ~20 min of the incident - Maintainer team coordinated immediately and effectively across many timezones - The detection community already had a clear public IOC pattern within hours ### What could have been better - No internal alerting\. We learned about the compromise from a third party\. We need monitoring on our own publishes\. We'll be working closely with security researcher firms in the ecosystem that have the ability to detect these issues very quickly, potentially even in\-house, and making the feedback loop even tighter\. - pull\_request\_targetworkflows had not been audited despite being a long\-known dangerous pattern - Floating refs \(@v6\.0\.2,@main\) on third\-party actions create standing supply\-chain risk independent of this incident - Unpublish was unavailable for nearly all affected packages because of npm's "no unpublish if dependents exist" policy\. We have to rely on npm security to pull tarballs server\-side, which adds hours of delay during which malicious tarballs remain installable - The 7\-maintainer list on the npm scope means seven separate credential\-theft targets for the same blast radius - OIDC trusted\-publisher binding has no per\-publish review\. Once configured, any code path in the workflow can mint a publish\-capable token\. We need either \(a\) move to short\-lived classic tokens with manual review, or \(b\) add provenance\-source\-verification to detect publishes from unexpected workflow steps ### What we got lucky on - The attacker chose a payload that broke tests, which made the publish step \(which would have produced cleaner\-looking tarballs\) skip — meaning the attack was loud enough to detect quickly\. A more careful attacker who didn't break tests could have published silently for hours longer - The attacker reused public tradecraft \(verbatim memory\-dump script with attribution comment\) instead of writing novel code — making the IOC\-matching faster --- These need answers before we close the postmortem\. - Didbundle\-size\.yml's Setup Tools step actually callactions/cache@v5? Verify by reading the post\-job logs from one of thepull\_request\_targetruns against PR \#7378 \(e\.g\., run id25666610798\)\. Tanner has access; needs to be done manually - What was in the initial PR head commit \(before the force\-pushes wiped it\)? GitHub's reflog may have it\. Check viagh apior the GitHub support team - How did the malicious commit get into the fork's git object store specifically — was it pushed directly via git, or was it created via the GitHub web UI \(which would leave audit\-log entries\)? - Wasvoicproducoesa real account or a sock puppet? Cross\-reference its activity history - Did the npm cache also get poisoned \(the 6 duplicatelinux\-npm\-store\-\*entries\)? Were any actually used? - Does the attack require Nx Cloud, or would it have worked with just GitHub Actions cache? - Can we identify any other fork in theTanStack/routerfork network that contains the orphan payload commit? \(If yes, the cleanup is harder — every fork hosting it keeps it accessible viagithub:tanstack/router\#79ac49ee\.\.\.\) - Are any other TanStack repos \(router, query, table, form, virtual, etc\.\) using the samebundle\-size\.yml\-style pattern? Audit needed - How many users actually downloaded the affected versions during the publish window? Get from npm support - Did any of the seven listed maintainers' machines get compromised separately? \(None of the malicious publishes used a maintainer's npm token, but maintainer machines could have been the secondary target via the self\-propagation logic\) --- - Tracking issue:[TanStack/router\#7383](https://github.com/TanStack/router/issues/7383) - GitHub Security Advisory:[GHSA\-g7cv\-rxg3\-hmpx](https://github.com/TanStack/router/security/advisories/GHSA-g7cv-rxg3-hmpx) - Related research:- Adnan Khan, "The Monsters in Your Build Cache: Github Actions Cache Poisoning" \(May 2024\) —[adnanthekhan\.com](https://adnanthekhan.com/2024/05/06/the-monsters-in-your-build-cache-github-actions-cache-poisoning/) - GitHub Security Lab, "Keeping your GitHub Actions and workflows secure: Preventing pwn requests" —[securitylab\.github\.com](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) - StepSecurity, "Harden\-Runner detection: tj\-actions/changed\-files action is compromised" \(March 2025\) —[stepsecurity\.io](https://www.stepsecurity.io/blog/harden-runner-detection-tj-actions-changed-files-action-is-compromised) - npm policies:- Unpublish:[docs\.npmjs\.com/policies/unpublish](https://docs.npmjs.com/policies/unpublish) - Provenance:[docs\.npmjs\.com/generating\-provenance\-statements](https://docs.npmjs.com/generating-provenance-statements) --- See the GitHub Security Advisory for the full list of affected versions:[GHSA\-g7cv\-rxg3\-hmpx](https://github.com/TanStack/router/security/advisories/GHSA-g7cv-rxg3-hmpx)

Similar Articles

Our response to the TanStack npm supply chain attack

OpenAI Blog

OpenAI responds to the TanStack npm supply chain attack, stating that no user data or production systems were compromised, but two employee devices were impacted and limited credentials exfiltrated from internal code repositories.

TanStack NPM Packages Compromised

Hacker News Top

Reports indicate a security compromise affecting TanStack NPM packages, impacting developers using the TanStack Router and Start frameworks.