CVE-2022-40764: Snyk Snyk CLI Affected By Command Vulnerability

HIGH
Advisory Identifier: GHSA-hpqj-7cj6-hfj8
CVSS 7.8
CWE-78
Published
Advisory Summary

CVE-2022-40764 is a HIGH (CVSS 7.8) snyk cli affected by command vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Snyk libraries in the npm ecosystem. The issue involves snyk cli affected by command injection vulnerability. Remediation is available by upgrading affected packages to version 1.996.0, 1.19.1.

CVE-2022-40764 at a Glance

CVE Identifier CVE-2022-40764
GHSA Identifier GHSA-hpqj-7cj6-hfj8
Severity HIGH
CVSS v3.1 Base Score 7.8
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Snyk
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-40764

To remediate this vulnerability, upgrade all affected Snyk dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

snyk fixed: 1.996.0
npm install snyk@1.996.0
snyk-go-plugin fixed: 1.19.1
npm install snyk-go-plugin@1.19.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls snyk

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2022-40764, inspect your project dependencies using npm:

npm ls snyk

Analyze the terminal output to locate any version of Snyk in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.996.0), your application is affected.

Note: The npm ls snyk 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-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Snyk, 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

Snyk CLI before 1.996.0 allows arbitrary command execution, affecting Snyk IDE plugins and the snyk npm package. Exploitation could follow from the common practice of viewing untrusted files in the Visual Studio Code editor, for example. The original demonstration was with shell metacharacters in the vendor.json ignore field, affecting snyk-go-plugin before 1.19.1. This affects, for example, the Snyk TeamCity plugin (which does not update automatically) before 20220930.142957.

CVE-2022-40764 Affected Snyk Versions

2 component(s)
Fixed Versions:
1.996.01.19.1
Product / Package Ecosystem Affected Versions Fixed Version
snyk
npm
< 1.996.0
1.996.0
snyk-go-plugin
npm
< 1.19.1
1.19.1

References

Frequently Asked Questions

What is CVE-2022-40764?
CVE-2022-40764 is a security vulnerability in Snyk involving Snyk CLI affected by Command Injection vulnerability under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Snyk versions are affected?
Affected versions include releases prior to 1.996.0, 1.19.1 across affected packages: snyk, snyk-go-plugin.
What version fixes CVE-2022-40764?
Upgrading to 1.996.0, 1.19.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is snyk affected?
Yes, snyk is affected in releases prior to 1.996.0. Upgrade your dependency to 1.996.0 or later.
Is snyk-go-plugin affected?
Yes, snyk-go-plugin is affected in releases prior to 1.19.1. Upgrade your dependency to 1.19.1 or later.
What is the CVSS score of CVE-2022-40764?
CVE-2022-40764 has a CVSS v3.1 base score of 7.8 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-40764?
CVE-2022-40764 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2022-40764?
Run the dependency tree command: 'npm ls snyk'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hpqj-7cj6-hfj8",
  "modified" : "2022-10-06T18:20:46Z",
  "published" : "2022-10-04T00:00:22Z",
  "aliases" : [ "CVE-2022-40764" ],
  "summary" : "Snyk CLI affected by Command Injection vulnerability",
  "details" : "Snyk CLI before 1.996.0 allows arbitrary command execution, affecting Snyk IDE plugins and the snyk npm package. Exploitation could follow from the common practice of viewing untrusted files in the Visual Studio Code editor, for example. The original demonstration was with shell metacharacters in the vendor.json ignore field, affecting snyk-go-plugin before 1.19.1. This affects, for example, the Snyk TeamCity plugin (which does not update automatically) before 20220930.142957.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "snyk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.996.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "snyk-go-plugin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.19.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-40764"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/snyk/cli"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/snyk/cli/releases/tag/v1.996.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/snyk/snyk-go-plugin/releases/tag/v1.19.1"
  }, {
    "type" : "WEB",
    "url" : "https://support.snyk.io/hc/en-us/articles/7015908293789-CVE-2022-40764-Command-Injection-vulnerability-affecting-Snyk-CLI-versions-prior-to-1-996-0"
  }, {
    "type" : "WEB",
    "url" : "https://www.imperva.com/blog/how-scanning-your-projects-for-security-issues-can-lead-to-remote-code-execution"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-10-05T21:28:25Z",
    "nvd_published_at" : "2022-10-03T15:15:00Z"
  }
}