---
title: "GHSA-hrvq-x7jp-36xv: Nx: Path traversal in nx migrate package-migrations extraction"
description: "Moderate severity. Nx: Path traversal in nx migrate package-migrations extraction. Affects nx; fixed in 23.2.1."
url: https://inlinr.com/advisories/GHSA-hrvq-x7jp-36xv
lang: en
---

[Packages](https://inlinr.com/packages) / [nx](https://inlinr.com/packages/nx) / [Security](https://inlinr.com/packages/nx/security)

Moderate Vulnerability GHSA-hrvq-x7jp-36xv CVE-2026-104853 Published 5 Oct 2026

# Nx: Path traversal in nx migrate package-migrations extraction

Your version 

Affected releases · [nx](https://inlinr.com/packages/nx)

- 23.x 23.0.0 – 23.2.0 Fixed in 23.2.1
- 22.x 22.0.0 – 22.7.9 Fixed in 22.7.10
- 21.x and older 13.10.0 – 21.8.0 No fix, no longer updated

On 23.x, the newest line:

```
npm install nx@23.2.1
```

Every release on a timeline

9999.x 

1. Not affected

9999.0.1  
1 release

23.x 

1. Affected

23.0.0 – 23.2.0  
8 releases
2. Fixed

23.2.1 – 23.3.3  
5 releases

22.x 

1. Affected

22.0.0 – 22.7.9  
48 releases
2. Fixed

22.7.10 – 22.7.12  
3 releases

21.x 

1. Affected

21.0.0 – 21.8.0  
47 releases

20.x 

1. Affected

20.0.0 – 20.12.0  
53 releases

19.x 

1. Affected

19.0.0 – 19.8.15  
65 releases

18.x 

1. Affected

18.0.0 – 18.3.5  
24 releases

17.x 

1. Affected

17.0.0 – 17.3.2  
22 releases

16.x 

1. Affected

16.0.0 – 16.10.0  
35 releases

15.x 

1. Affected

15.0.0 – 15.9.7  
60 releases

14.x 

1. Affected

14.0.0 – 14.8.9  
83 releases

13.x 

1. Not affected

13.0.0 – 13.9.7  
60 releases
2. Affected

13.10.0 – 13.10.6  
7 releases

666 stable releases of nx, oldest to newest, one row per major.

## What happens

Summary

`nx migrate` reads each target package's `nx-migrations.migrations` value from its manifest and extracts the referenced file to a path built by joining that value onto a temporary directory. The value is never validated, so a package whose `migrations` field contains `..` segments (or an absolute path) steers the extraction to write outside the temporary directory. A hostile package — or any package pulled in transitively through a trusted package's `packageGroup` — can write attacker-controlled content, or truncate an existing file, anywhere the running user can write. This happens during migration _planning_, before the user reviews the migration list and before `--run-migrations`, so it does not require the user to approve or execute anything.

**Most workspaces need no action.** By default `nx migrate` does not run the nx installed in your workspace — it installs `nx@latest` into a temporary directory and performs the upgrade planning, including this extraction, with that copy. Now that a patched nx is the latest release, a default `nx migrate` run is unaffected whatever version the workspace has installed. The installed version only runs, and is only then exposed, when that hand-off is bypassed — see Remediation.

Severity

Exploitable when the victim runs `nx migrate` against a package the attacker controls, directly or through a trusted package's `packageGroup`. The primary impact is a file write with attacker-controlled content and no path confinement; overwriting an auto-loaded file (a shell rc, a git hook, a CI script) escalates that write to code execution. There is no known evidence of exploitation in the wild.

Affected & Patched Versions

| Package | Vulnerable                                   | Patched         |
| ------- | -------------------------------------------- | --------------- |
| nx      | \>= 13.10.0, < 22.7.10; \>= 23.0.0, < 23.2.1 | 22.7.10, 23.2.1 |

Every version in the ranges above is affected. The lower bound is 13.10.0, the first release where `nx migrate` extracted a package's migrations file from its tarball; earlier versions resolved migrations without that extraction.

Important

`nx migrate` normally fetches and runs `nx@latest` rather than the nx installed in your workspace. The ranges above therefore say where the vulnerable code ships, not who is exposed — it only runs when that hand-off is bypassed.

Remediation

**If you run `nx migrate` normally, there is nothing to do.** It resolves and runs the latest nx, which is patched, so your workspace's own nx version does not matter for this flaw.

Upgrade only if you bypass that hand-off and run the workspace's nx instead — that is, if you set `NX_USE_LOCAL` or `NX_MIGRATE_USE_LOCAL`, pin `NX_MIGRATE_CLI_VERSION` to an affected version, resume an existing run with `--run-id`, or run where the temporary install fails and `nx migrate` falls back to the local nx. In those cases upgrade to **22.7.10** (22.x line) or **23.2.1** (23.x line) or later:

```
nx migrate 23.2.1
```

The fix is a drop-in — no configuration changes are required, and no legitimate `migrations` value is affected (real packages reference `./migrations.json` or another path within their own directory, all of which remain valid). Either way, do not run `nx migrate` against packages, or `packageGroup` members, that you do not trust.

Details

While planning an upgrade, `nx migrate` extracts each target package's migrations file to a destination built by joining the package's own `nx-migrations.migrations` value onto a temporary directory. That value is read from the manifest without validation, and it is handled asymmetrically: the name Nx matches against the archive entries is normalized (so its `..` segments collapse), while the destination path it writes to is a raw join that keeps the `..` segments and resolves outside the temporary directory. Because the attacker controls the tarball, they name their entry to equal the normalized form; the match then succeeds and the bytes are written to the un-normalized, escaping destination. The normalization is not a defence — it only dictates what the attacker must name their entry.

The same value also seeds the directory used for prompt-file extraction, which has the same shape, so both writes are steerable from the one field.

Two distinct primitives fall out of this:

- **Truncation** — the destination write stream is opened, and truncates, before any tar entry is inspected. So a package that points `migrations` at an existing file empties that file even when no tar entry matches — no crafted archive required.
- **Controlled write** — when a tar entry's name matches, its bytes are written to the escaping destination. The extractor performs no path containment of its own.

Credits

- **Arkadiusz Marta** (RE:SOURCE) — Reporter

## How it is exploited

Exploitable with local access, with no account and a user to do something.

- **Confidentiality**: low
- **Integrity**: high
- **Availability**: low

CVSS:4.0/​AV:L/​AC:L/​AT:P/​PR:N/​UI:P/​VC:L/​VI:H/​VA:L/​SC:N/​SI:N/​SA:N

## References

- [Reference](https://github.com/nrwl/nx/security/advisories/GHSA-hrvq-x7jp-36xv "https://github.com/nrwl/nx/security/advisories/GHSA-hrvq-x7jp-36xv")  
github.com/nrwl/nx/security/advisories/GHSA-hrv…
- [NVD](https://nvd.nist.gov/vuln/detail/CVE-2026-104853 "https://nvd.nist.gov/vuln/detail/CVE-2026-104853")  
nvd.nist.gov/vuln/detail/CVE-2026-104853
- [Pull request](https://github.com/nrwl/nx/pull/36887 "https://github.com/nrwl/nx/pull/36887")  
#36887
- [Fix commit](https://github.com/nrwl/nx/commit/38cd82a0c05e8212e538bdb87ccb198d6504e58f "https://github.com/nrwl/nx/commit/38cd82a0c05e8212e538bdb87ccb198d6504e58f")  
38cd82a
- [Fix commit](https://github.com/nrwl/nx/commit/95474ab457e8e1dbdbefad29040c166105a8fb90 "https://github.com/nrwl/nx/commit/95474ab457e8e1dbdbefad29040c166105a8fb90")  
95474ab
- [Fix commit](https://github.com/nrwl/nx/commit/de37c5ebd1852fac700d70726326236ac398af3f "https://github.com/nrwl/nx/commit/de37c5ebd1852fac700d70726326236ac398af3f")  
de37c5e
- [Package](https://github.com/nrwl/nx "https://github.com/nrwl/nx")  
github.com/nrwl/nx
- [Reference](https://github.com/nrwl/nx/releases/tag/22.7.10 "https://github.com/nrwl/nx/releases/tag/22.7.10")  
github.com/nrwl/nx/releases/tag/22.7.10
- [Reference](https://github.com/nrwl/nx/releases/tag/23.2.1 "https://github.com/nrwl/nx/releases/tag/23.2.1")  
github.com/nrwl/nx/releases/tag/23.2.1

A whole project to check? Paste its package.json in the [dependency check](https://inlinr.com/tools/dependency-check): every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.
