From a PR title to npm: the Nx supply chain attack in the postmortem
The article reviews the 2025 attack on Nx, a build system for monorepos, based on the project's postmortem.
The vulnerable workflow pr-title-validation.yml was merged into master on 21 August 2025 and reverted there on 22 August, but other branches still contained it. On 24 August an attacker opened a pull request and stole an npm token, and on 26–27 August 2025 malicious Nx versions were published; about four hours later they were removed from npm.
The workflow used pull_request_target and inserted the PR title directly into a shell echo command, which allowed script injection [1]. Because the workflow ran from the version on the target branch, the attacker could run the unfixed version on branches that still contained it, and the malicious script stole a GITHUB_TOKEN with read and write permissions.
The modified publish-resolve-data.js sent the npm token to an external URL controlled by the attacker, who then used the classic npm token [2] to publish a malicious Nx version with a postinstall script. That package had no provenance [3], because it was published directly from the attacker's environment. The article notes that in the TanStack case, OIDC tokens [4] were stolen instead.
Sources
-
JPZenn JA
PRのタイトルからnpm公開まで:ポストモーテムから読み解くNxサプライチェーン攻撃





