CVE-2021-41116: Composer/composer Improper Escaping Of Command Arguments Vulnerability
HIGHCVE-2021-41116 is a HIGH (CVSS 8.2) improper escaping of command arguments vulnerability (CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')) affecting Composer/composer libraries in the Packagist ecosystem. The issue involves improper escaping of command arguments on windows leading to command injection. Remediation is available by upgrading affected packages to version 1.10.23, 2.1.9.
CVE-2021-41116 at a Glance
Security Impact
CVSS: 8.2
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N).
How to Fix CVE-2021-41116
To remediate this vulnerability, upgrade all affected Composer/composer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade composer/composer to 1.10.23
Upgrade composer/composer to 2.1.9
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for composer/composer
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-41116, inspect your project dependencies for Composer/composer:
inspect dependencies for composer/composer
Analyze the terminal output to locate any version of Composer/composer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.10.23), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), where the product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. In Composer/composer, 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-2021-41116 Affected Composer/composer Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
composer/composer
|
Packagist |
< 1.10.23
|
1.10.23
|
|
composer/composer
|
Packagist |
≥ 2.0.0-alpha1
< 2.1.9
|
2.1.9
|
References
Frequently Asked Questions
What is CVE-2021-41116?
Which Composer/composer versions are affected?
What version fixes CVE-2021-41116?
Is composer/composer affected?
What is the CVSS score of CVE-2021-41116?
What CWE is associated with CVE-2021-41116?
How can I check Packagist dependencies for CVE-2021-41116?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-frqg-7g38-6gcf",
"modified" : "2021-10-11T18:39:06Z",
"published" : "2021-10-05T20:23:18Z",
"aliases" : [ "CVE-2021-41116" ],
"summary" : "Improper escaping of command arguments on Windows leading to command injection",
"details" : "### Impact\nWindows users running Composer to install untrusted dependencies are affected and should definitely upgrade for safety. Other OSs and WSL are not affected. \n\n### Patches\n1.10.23 and 2.1.9 fix the issue\n\n### Workarounds\nNone\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "composer/composer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.10.23"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "composer/composer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0-alpha1"
}, {
"fixed" : "2.1.9"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/composer/composer/security/advisories/GHSA-frqg-7g38-6gcf"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-41116"
}, {
"type" : "WEB",
"url" : "https://github.com/composer/composer/commit/ca5e2f8d505fd3bfac6f7c85b82f2740becbc0aa"
}, {
"type" : "WEB",
"url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/composer/composer/CVE-2021-41116.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/composer/composer"
}, {
"type" : "WEB",
"url" : "https://www.sonarsource.com/blog/securing-developer-tools-package-managers"
}, {
"type" : "WEB",
"url" : "https://www.tenable.com/security/tns-2022-09"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-77" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-10-05T18:44:04Z",
"nvd_published_at" : "2021-10-05T18:15:00Z"
}
}