Skip to content

GHSA-9m87-6fj3-c5xh CVE-2022-26183

Untrusted Search Path in PNPM

High npm
Severity
8.8 / 10
High · CVSS 3.1
Exploit chance (EPSS)
1.59%
Chance of exploitation in the next 30 days. Higher than 75.72% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-426 Untrusted Search Path
Fix
6.15.1
Upgrade pnpm to this version or later

Description

PNPM prior to v6.15.1 was discovered to contain an untrusted search path which causes the application to behave in unexpected ways when users execute PNPM commands in a directory containing malicious content. This vulnerability occurs when the application is ran on Windows OS.

Affected versions

npm

PackageVulnerableFixed in
pnpm
< 6.15.1
6.15.1

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

pnpm npm → 6.15.1

npm
npm install pnpm@6.15.1
yarn
yarn add pnpm@6.15.1
pnpm
pnpm add pnpm@6.15.1

Severity breakdown

CVSS 3.1 8.8

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

Weakness

CWE-426: Untrusted Search Path

The product searches for critical resources using an externally-supplied search path that can point to resources that are not under the product's direct control.

How to prevent it
  • Architecture and Design, Implementation: Hard-code the search path to a set of known-safe values (such as system directories), or only allow them to be specified by the administrator in a configuration file. Do not allow these settings to be modified by an external party. Be careful to avoid related weaknesses such as CWE-426 and CWE-428.
  • Implementation: When invoking other programs, specify those programs using fully-qualified pathnames. While this is an effective approach, code that uses fully-qualified pathnames might not be portable to other systems that do not use the same pathnames. The portability can be improved by locating the full-qualified paths in a centralized, easily-modifiable location within the source code, and having the code refer to these paths.
  • Implementation: Remove or restrict all environment settings before invoking other programs. This includes the PATH environment variable, LD_LIBRARY_PATH, and other settings that identify the location of code libraries, and any application-specific search paths.
  • Implementation: Check your search path before use and remove any elements that are likely to be unsafe, such as the current working directory or a temporary files directory.
  • Implementation: Use other functions that require explicit paths. Making use of any of the other readily available functions that require explicit paths is a safe way to avoid this problem. For example, system() in C does not require a full path since the shell can take care of it, while execl() and execv() require a full path.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-vx52-2968-3vc6
pnpm: Environment secrets exfiltrated via env-placeholder expansion in proxy settings read from an untrusted pnpm-workspace.yaml
High Also affects pnpm
GHSA-2rx9-3g3h-c2jv
pnpm: pacquet trust-lockfile install can create dependency symlinks outside the project
High Also affects pnpm
GHSA-vq4v-j7r6-jq4m
pnpm: A tarball dependency's manifest `name` escapes node_modules → arbitrary file write/overwrite on install
High Also affects pnpm
GHSA-c59q-g84q-2gj5
pnpm: Virtual store linker path traversal via unvalidated depPath name in lockfileToDepGraph
High Also affects pnpm
GHSA-qrv3-253h-g69c
pnpm: Path traversal in configDependencies env lockfile allows symlink creation outside node_modules/.pnpm-config
High Also affects pnpm
GHSA-72r4-9c5j-mj57
pnpm: `patch-remove` could delete project-selected files outside the patches directory
High Also affects pnpm
GHSA-fr4h-3cph-29xv
pnpm: Hoisted install imports lockfile alias outside node_modules
High Also affects pnpm
GHSA-v23m-ccfg-pq9h
pnpm: `stage download` writes outside its destination directory via manifest name/version traversal
High Also affects pnpm
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor