CVE-2022-40764: Snyk Snyk CLI Affected By Command Vulnerability
HIGHCVE-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
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).
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.
npm install snyk@1.996.0
npm install snyk-go-plugin@1.19.1
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
CVE-2022-40764 Affected Snyk Versions
2 component(s)| 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?
Which Snyk versions are affected?
What version fixes CVE-2022-40764?
Is snyk affected?
Is snyk-go-plugin affected?
What is the CVSS score of CVE-2022-40764?
What CWE is associated with CVE-2022-40764?
How can I check npm dependencies for CVE-2022-40764?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}