CVE-2022-0764: Strapi Command Injection Vulnerability
MODERATECVE-2022-0764 is a MODERATE (CVSS 6.1) command injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Strapi libraries in the npm ecosystem. The issue involves command injection in strapi. Remediation is available by upgrading affected packages to version 4.1.0.
CVE-2022-0764 at a Glance
Security Impact
CVSS: 6.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:L).
How to Fix CVE-2022-0764
To remediate this vulnerability, upgrade all affected Strapi 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 strapi@4.1.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls strapi
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2022-0764, inspect your project dependencies using npm:
npm ls strapi
Analyze the terminal output to locate any version of Strapi in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.1.0), your application is affected.
Note: The npm ls strapi 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 Strapi, 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-0764 Affected Strapi Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
strapi
|
npm |
< 4.1.0
|
4.1.0
|
References
Frequently Asked Questions
What is CVE-2022-0764?
Which Strapi versions are affected?
What version fixes CVE-2022-0764?
Is strapi affected?
What is the CVSS score of CVE-2022-0764?
What CWE is associated with CVE-2022-0764?
How can I check npm dependencies for CVE-2022-0764?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xrjf-phvv-r4vr",
"modified" : "2022-03-09T20:26:21Z",
"published" : "2022-02-27T00:00:15Z",
"aliases" : [ "CVE-2022-0764" ],
"summary" : "Command injection in strapi",
"details" : "When creating a strapi app using npxcreate-strapi-app, we can inject arbitrary commands through the template cli argument as per the code in this particular [link](https://github.com/strapi/strapi/blob/master/packages/generators/app/lib/utils/fetch-npm-template.js#L13), this happens due to improper sanitization of user input.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "strapi"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.1.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-0764"
}, {
"type" : "WEB",
"url" : "https://github.com/strapi/strapi/issues/12879"
}, {
"type" : "WEB",
"url" : "https://github.com/strapi/strapi/commit/2a3f5e988be6a2c7dae5ac22b9e86d579b462f4c"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/strapi/strapi"
}, {
"type" : "WEB",
"url" : "https://github.com/strapi/strapi/blob/master/packages/generators/app/lib/utils/fetch-npm-template.js#L13"
}, {
"type" : "WEB",
"url" : "https://huntr.dev/bounties/001d1c29-805a-4035-93bb-71a0e81da3e5"
}, {
"type" : "WEB",
"url" : "https://www.github.com/strapi/strapi/commit/2a3f5e988be6a2c7dae5ac22b9e86d579b462f4c"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-77", "CWE-78" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-03-01T21:42:15Z",
"nvd_published_at" : "2022-02-26T15:15:00Z"
}
}