# CVE-2023-37478: pnpm incorrectly parses tar archives relative to specification

> Attackers can distribute malicious packages that appear safe on npm but execute code when installed via pnpm due to incorrect tar parsing.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Aug 2023
- **Updated:** 10 Oct 2024
- **Also known as:** GHSA-5r98-f33j-g8h7

## What is CVE-2023-37478?

CVE-2023-37478 is a high-severity vulnerability in pnpm, published on 1 Aug 2023. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

pnpm is a package manager. It is possible to construct a tarball that, when installed via npm or parsed by the registry is safe, but when installed via pnpm is malicious, due to how pnpm parses tar archives. This can result in a package that appears safe on the npm registry or when installed via npm being replaced with a compromised or malicious version when installed via pnpm. This issue has been patched in version(s) 7.33.4 and 8.6.8.

Weakness: CWE-284 (Improper Access Control)

## Which versions are affected by CVE-2023-37478?

34 open source packages ship an affected version, including @pnpm/exe, @pnpm/cafs and @pnpm/linux-arm64. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@pnpm/exe` | npm | All versions | 7.33.4 |
| `@pnpm/exe` | npm | All versions | 7.33.4 |
| `@pnpm/exe` | npm | From 8.0.0 | 8.6.8 |
| `@pnpm/exe` | npm | From 8.0.0 | 8.6.8 |
| `@pnpm/cafs` | npm | All versions | 7.0.5 |
| `@pnpm/cafs` | npm | All versions | 7.0.5 |
| `@pnpm/linux-arm64` | npm | All versions | 7.33.4 |
| `@pnpm/linux-arm64` | npm | All versions | 7.33.4 |
| `@pnpm/linux-arm64` | npm | From 8.0.0 | 8.6.8 |
| `@pnpm/linux-arm64` | npm | From 8.0.0 | 8.6.8 |
| `@pnpm/linux-x64` | npm | All versions | 7.33.4 |
| `@pnpm/linux-x64` | npm | All versions | 7.33.4 |
| `@pnpm/linux-x64` | npm | From 8.0.0 | 8.6.8 |
| `@pnpm/linux-x64` | npm | From 8.0.0 | 8.6.8 |
| `@pnpm/linuxstatic-arm64` | npm | All versions | 7.33.4 |
| `@pnpm/linuxstatic-arm64` | npm | All versions | 7.33.4 |
| `@pnpm/linuxstatic-arm64` | npm | From 8.0.0 | 8.6.8 |
| `@pnpm/linuxstatic-arm64` | npm | From 8.0.0 | 8.6.8 |
| `@pnpm/macos-arm64` | npm | All versions | 7.33.4 |
| `@pnpm/macos-arm64` | npm | All versions | 7.33.4 |
| `@pnpm/macos-arm64` | npm | From 8.0.0 | 8.6.8 |
| `@pnpm/macos-arm64` | npm | From 8.0.0 | 8.6.8 |
| `@pnpm/macos-x64` | npm | All versions | 7.33.4 |
| `@pnpm/macos-x64` | npm | All versions | 7.33.4 |
| `@pnpm/macos-x64` | npm | From 8.0.0 | 8.6.8 |
| `@pnpm/macos-x64` | npm | From 8.0.0 | 8.6.8 |
| `@pnpm/win-x64` | npm | All versions | 7.33.4 |
| `@pnpm/win-x64` | npm | All versions | 7.33.4 |
| `@pnpm/win-x64` | npm | From 8.0.0 | 8.6.8 |
| `@pnpm/win-x64` | npm | From 8.0.0 | 8.6.8 |
| `pnpm` | npm | All versions | 7.33.4 |
| `pnpm` | npm | All versions | 7.33.4 |
| `pnpm` | npm | From 8.0.0 | 8.6.8 |
| `pnpm` | npm | From 8.0.0 | 8.6.8 |

Products: Pnpm Pnpm.

## How do I fix CVE-2023-37478?

Upgrade @pnpm/exe to a fixed version for your release line: 7.33.4 or 8.6.8.

## Is CVE-2023-37478 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-37478 exists.

Public exploit code:

- CVE-2023-37478 showcases how a difference in npm and pnpm install packages that could be exploited by a well crafted tar.gz packge. This repo shows a demo.  (github_poc): https://github.com/TrevorGKann/CVE-2023-37478_npm_vs_pnpm
- https://github.com/li-minhao/CVE-2023-37478-Demo (github_poc): https://github.com/li-minhao/CVE-2023-37478-Demo

## Other vulnerabilities in pnpm

- [CVE-2026-50016](https://insights.sbomify.com/CVE-2026-50016/): pnpm: Transitive dependency alias path traversal allows project path override via symlink replacement (high 8.8)
- [CVE-2026-55698](https://insights.sbomify.com/CVE-2026-55698/): pnpm: Project env lockfile can short-circuit package-manager resolution and execute lockfile-selected pnpm bytes (high 8.8)
- [CVE-2025-69264](https://insights.sbomify.com/CVE-2025-69264/): pnpm v10+ Bypass "Dependency lifecycle scripts execution disabled by default" (high 8.8)
- [CVE-2022-26183](https://insights.sbomify.com/CVE-2022-26183/): Untrusted Search Path in PNPM (high 8.8)
- [CVE-2026-59195](https://insights.sbomify.com/CVE-2026-59195/): pnpm: Path traversal in configDependencies env lockfile allows symlink creation outside node_modules/.pnpm-config (high 8.2)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-37478 and fix it if it is affected.

What it is: CVE-2023-37478 is a high-severity vulnerability in pnpm, published on 1 Aug 2023. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-37478 exists.

Affected packages and fixed versions:
- @pnpm/exe (npm): affected all versions; fixed in 7.33.4
- @pnpm/exe (npm): affected all versions; fixed in 7.33.4
- @pnpm/exe (npm): affected from 8.0.0; fixed in 8.6.8
- @pnpm/exe (npm): affected from 8.0.0; fixed in 8.6.8
- @pnpm/cafs (npm): affected all versions; fixed in 7.0.5
- @pnpm/cafs (npm): affected all versions; fixed in 7.0.5
- @pnpm/linux-arm64 (npm): affected all versions; fixed in 7.33.4
- @pnpm/linux-arm64 (npm): affected all versions; fixed in 7.33.4
- @pnpm/linux-arm64 (npm): affected from 8.0.0; fixed in 8.6.8
- @pnpm/linux-arm64 (npm): affected from 8.0.0; fixed in 8.6.8
- @pnpm/linux-x64 (npm): affected all versions; fixed in 7.33.4
- @pnpm/linux-x64 (npm): affected all versions; fixed in 7.33.4

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-37478/ (Markdown: https://insights.sbomify.com/CVE-2023-37478/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-37478
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-37478
- OSV: https://osv.dev/vulnerability/CVE-2023-37478

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-37478/
Summaries are generated and may contain mistakes; the official description above is the record.
