CVE-2022-21191
JavaScript vulnerability analysis and mitigation

Overview

CVE-2022-21191 affects versions of the package global-modules-path before 3.0.0. The vulnerability is classified as a Command Injection vulnerability due to missing input sanitization in the getPath function. The issue was disclosed on December 13, 2022, and published on January 12, 2023. The vulnerability has received a CVSS v3.1 base score of 9.8 (CRITICAL) from NVD and 7.4 (HIGH) from Snyk (Snyk Advisory).

Technical details

The vulnerability exists in the getPath function where missing input sanitization and lack of proper sandboxing allows for command injection. The issue stems from the usage of execSync command, which allowed threat actors to pass undesired commands through the parameters of the getPath method. The vulnerability was fixed by replacing the usage of execSync with spawnSync, which provides better protection against command injection attacks (GitHub Release).

Impact

A successful exploitation of this vulnerability could result in unauthorized access with high impact on confidentiality, integrity, and availability. According to the CVSS scoring, the vulnerability could lead to total loss of confidentiality, resulting in all resources being exposed to the attacker, complete loss of integrity allowing modification of protected files, and total loss of availability causing denial of access to resources (Snyk Advisory).

Exploitability

The vulnerability has a proof-of-concept exploit available. An example of exploitation involves calling the getPath function with malicious command injection parameters: root.getPath("& touch JHU","& touch exploit"). The attack requires no user interaction and can be executed by an unauthorized attacker, though it requires local access to the system (Snyk Advisory).

Mitigation and workarounds

The recommended mitigation is to upgrade global-modules-path to version 3.0.0 or higher. The fixed version replaces the vulnerable execSync implementation with spawnSync to prevent command injection attacks. While there are no breaking changes in the API, the package maintainers note that there might be differences in the results of calling the getPath method due to the implementation change (GitHub Release).

Additional resources


SourceThis report was generated using AI

Related JavaScript vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-77415CRITICAL9.3
  • JavaScript logoJavaScript
  • jsonata
NoYesAug 21, 2026
CVE-2026-77414CRITICAL9.3
  • JavaScript logoJavaScript
  • jsonata
NoYesAug 21, 2026
CVE-2026-77413CRITICAL9.3
  • JavaScript logoJavaScript
  • jsonata
NoYesAug 21, 2026
CVE-2026-63421HIGH7.5
  • JavaScript logoJavaScript
  • @keystone-6/core
NoYesAug 21, 2026
CVE-2026-53509MEDIUM5.7
  • JavaScript logoJavaScript
  • @aborruso/ckan-mcp-server
NoYesAug 21, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management