High, CVSS 7.5npmAmendedPublished
pnpm incorrectly parses tar archives relative to specification
CVE-2023-37478 · GHSA-5r98-f33j-g8h7
- Affected
- npm @pnpm/linux-arm64 < 7.33.4; >= 8.0.0, < 8.6.8
- Fixed in
- 8.6.87.33.4· Vendor fix available
- Issue
- 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. Details The TAR format is an append-only archive format, and as such, the specification for how to update a file is to add a new record to the end with the updated version of the file. This means that it is completely valid for an archive to contain multiple copies of, say, package.json, and the expected behavior when extracting is that all versions other than the last get ignored. This is further complicated by that during tarball extraction, all package managers are configured to drop the first path component, so collisions can be created simply by using multiple root folders in the archive, even without performing updates. When pnpm extracts a tar archive via tar-stream, it appears to extract only the first file of a given name and discards all subsequent files with the same name. PoC Create a…
Recommended action: Upgrade to 8.6.8 or 7.33.4 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.