CVE-2026-104853: Nx: Path traversal in nx migrate package-migrations extraction
Nx is a monorepo solution for TypeScript and polyglot codebases. From 13.10.0 until 22.7.10 and 23.2.1, Nx migration planning reads the nx-migrations.migrations value from a target package manifest without validating that it is a contained relative path. A hostile direct dependency or a package introduced through a trusted package's packageGroup can supply .. segments or an absolute path, causing nx migrate to join an escaping destination onto its temporary directory. The migration archive can then write attacker-controlled bytes outside the temporary directory, while opening the destination stream can truncate an existing writable file even when no archive entry matches. This occurs during migration planning before review of the migration list or use of --run-migrations; the vulnerable installed Nx copy is reached when the normal nx@latest handoff is bypassed with NXUSELOCAL, NXMIGRATEUSELOCAL, NXMIGRATECLIVERSION, --run-id, or fallback after a temporary-install failure. This issue is fixed in versions 22.7.10 and 23.2.1.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Nxto a version that resolves this vulnerability.Fixed in 22.7.10 - Upgrade
Upgrade
Nxto a version that resolves this vulnerability.Fixed in 23.2.1
Event History
Frequently Asked Questions
When is a local vulnerable Nx installation used during migration planning?
The issue is reached when the normal nx@latest handoff is bypassed with NX_USE_LOCAL, NX_MIGRATE_USE_LOCAL, NX_MIGRATE_CLI_VERSION, or --run-id. It can also be reached if a temporary Nx installation fails and Nx falls back to the locally installed copy.
What must an attacker control to exploit this?
An attacker needs to supply a hostile direct dependency, or a package introduced through a trusted package's packageGroup, whose package manifest contains a crafted nx-migrations.migrations value. That value can use absolute paths or .. segments to escape Nx's temporary extraction directory.
Does exploitation require running the selected migrations?
No. The vulnerable extraction occurs during migration planning, before the migration list is reviewed and before --run-migrations is used. Opening the destination stream may truncate an existing writable file even if the migration archive contains no matching entry.
What versions contain the fix?
The issue is fixed in Nx 22.7.10 and 23.2.1. Versions from 13.10.0 up to the fixed releases are affected.