Nx: Zip-Slip in the self-hosted remote cache
Affected releases · @nx/azure-cache
- 5.x5.0.0 – 5.0.7No fix on this line yet
- 4.x and older1.3.0 – 4.0.0No fix, no longer updated
No release fixes it yet, not even the latest, 5.0.7.
Every release on a timeline
Affected
5.0.0 – 5.0.7
8 releases, latest
Affected
4.0.0
1 release
Affected
3.0.0 – 3.1.1
4 releases
Affected
2.0.0 – 2.1.0
5 releases
Affected
1.3.0 – 1.3.3
4 releases
Affected releases · @nx/gcs-cache
- 5.x5.0.0 – 5.0.7No fix on this line yet
- 4.x and older1.3.0 – 4.0.0No fix, no longer updated
No release fixes it yet, not even the latest, 5.0.7.
Every release on a timeline
Affected
5.0.0 – 5.0.7
8 releases, latest
Affected
4.0.0
1 release
Affected
3.0.0 – 3.1.1
4 releases
Affected
2.0.0 – 2.1.0
5 releases
Affected
1.3.0 – 1.3.3
4 releases
Affected releases · @nx/s3-cache
- 5.x5.0.0 – 5.0.7No fix on this line yet
- 4.x and older1.3.0 – 4.0.0No fix, no longer updated
No release fixes it yet, not even the latest, 5.0.7.
Every release on a timeline
Affected
5.0.0 – 5.0.7
8 releases, latest
Affected
4.0.0
1 release
Affected
3.0.0 – 3.1.1
4 releases
Affected
2.0.0 – 2.1.0
5 releases
Affected
1.3.0 – 1.3.3
4 releases
Affected releases · @nx/shared-fs-cache
- 5.x5.0.0 – 5.0.7No fix on this line yet
- 4.x and older1.3.0 – 4.0.0No fix, no longer updated
No release fixes it yet, not even the latest, 5.0.7.
Every release on a timeline
Affected
5.0.0 – 5.0.7
8 releases, latest
Affected
4.0.0
1 release
Affected
3.0.0 – 3.1.1
4 releases
Affected
2.0.0 – 2.1.0
5 releases
Affected
1.3.0 – 1.3.3
4 releases
Affected releases · nx
- 23.x23.0.0 – 23.0.1Fixed in 23.0.2
- 22.x22.0.0 – 22.7.6Fixed in 22.7.7
- 21.x and older20.8.0 – 21.8.0No fix, no longer updated
On 23.x, the newest line:
npm install nx@23.0.2Every release on a timeline
Not affected
9999.0.1
1 release
Affected
23.0.0 – 23.0.1
2 releases
Fixed
23.0.2 – 23.3.3
11 releases
Affected
22.0.0 – 22.7.6
45 releases
Fixed
22.7.7 – 22.7.12
6 releases
Affected
21.0.0 – 21.8.0
47 releases
Not affected
20.0.0 – 20.7.2
44 releases
Affected
20.8.0 – 20.12.0
9 releases
What happens
Summary
The Nx self-hosted HTTP remote cache extracts downloaded cache artifacts without constraining where files are written. A malicious — or on-path (MITM) — remote cache server can return a crafted tar archive whose entries escape the cache directory and write to arbitrary locations on the machine running Nx. This arbitrary file write can be escalated to remote code execution. The directly exploitable issue is the self-hosted HTTP remote cache.
Affected Packages
Important
Nx's default local cache and Nx Cloud are NOT affected. The default local cache and Nx Cloud use separate cache retrieval and extraction mechanisms that does not have this vulnerability. Only workspaces that use a self-hosted remote cache (NX_SELF_HOSTED_REMOTE_CACHE_SERVER, @nx/s3-cache, etc.) are affected.
Two self-hosted cache surfaces are affected:
The built-in HTTP remote cache (
NX_SELF_HOSTED_REMOTE_CACHE_SERVER, innx) — fixed in the patched release.The self-hosted cache packages —
@nx/s3-cache,@nx/gcs-cache,@nx/azure-cache,@nx/shared-fs-cache(and their@nx/powerpack-*predecessors) — the same flaw in their own extractor. Deprecated (CVE-2025-36852) and not patched; migrate off (see Remediation).
The shared step that copies cached outputs into the workspace was also part of the exposure and is hardened in the patched nx release.
Remediation
Upgrade to Nx 22.7.7 or 23.0.2 (or later). The patched extractor is a drop-in — no configuration change is required.
If you use the S3, GCS, Azure, or shared-filesystem cache packages
@nx/s3-cache, @nx/gcs-cache, @nx/azure-cache, and @nx/shared-fs-cache (and their @nx/powerpack-* predecessors) are separately versioned packages and are already deprecated (see CVE-2025-36852). Upgrading nx hardens the shared restore step, but it does not fully secure these packages. The remediation for them is to migrate off — to Nx Cloud or the self-hosted OpenAPI/HTTP remote cache — per the deprecation guidance: nx.dev/docs/reference/deprecated/self-hosted-ca…
Details
When Nx retrieves an artifact from the self-hosted HTTP remote cache, it downloads a gzipped tar archive and extracts it. The extractor joined each untrusted tar entry name directly onto the output directory and unpacked it with tar's unguarded Entry::unpack(), which performs no containment check:
// vulnerable let path_on_disk = output_dir.join(entry_path); // entry_path is attacker-controlled fs::create_dir_all(path_on_disk.parent()…)?; entry.unpack(&path_on_disk)?;
In addition, restore now copies only the declared task outputs (never the whole cache directory), confined to the workspace root; parent directories are realized as real directories so a write can never traverse a symlink; declared outputs that resolve outside the workspace are rejected; and the malformed-input cases return errors instead of panicking.
References
Fix: #36116 (merged)
TLS-verification warning follow-up: #36132 (merged)
Vulnerable extractor introduced in Nx 20.8.0: #30593
Credits
Lidor B., Novee Security — Reporter
Assaf Levkovich, Novee Security — Reporter
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.