CVE-2021-41116 Command injection in composer on Windows
Windows users installing untrusted dependencies via Composer are vulnerable to command injection, allowing attackers to execute arbitrary code.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2021-41116?
CVE-2021-41116 is a high-severity command injection vulnerability in composer, published on 5 Oct 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
Composer is an open source dependency manager for the PHP language. In affected versions windows users running Composer to install untrusted dependencies are subject to command injection and should upgrade their composer version. Other OSs and WSL are not affected. The issue has been resolved in composer versions 1.10.23 and 2.1.9. There are no workarounds for this issue.
Weakness: CWE-77
Which versions are affected by CVE-2021-41116?
5 open source packages ship an affected version, including composer/composer and composer. It affects 2 products.
| Package | Affected | Fixed in |
|---|---|---|
composer/composer Packagist | All versions | 1.10.23 |
composer/composer Packagist | All versions | 1.10.23 |
composer/composer Packagist | From 2.0.0-alpha1 | 2.1.9 |
composer/composer Packagist | From 2.0.0-alpha1 | 2.1.9 |
composer Bitnami | All versions | 1.10.23, 2.1.9 |
Linux distribution packages (2)
php-composer openSUSE:Tumbleweed | All versions | 1.10.25-1.1 |
php-composer2 openSUSE:Tumbleweed | All versions | 2.1.12-1.1 |
Products include Getcomposer Composer, Tenable Tenable.sc.
How do I fix CVE-2021-41116?
Upgrade composer/composer to a fixed version for your release line: 1.10.23 or 2.1.9.
Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.
Is CVE-2021-41116 being exploited?
There is no known exploitation of CVE-2021-41116 in the wild and no public exploit code.
Other vulnerabilities in composer
- CVE-2026-40261 Composer has Command Injection via Malicious Perforce Reference
- CVE-2024-24821 Code execution and possible privilege escalation via compromised InstalledVersions.php or installed.php in Composer
- CVE-2015-8371 Composer allows cache poisoning from other projects built on the same host
- CVE-2026-40176 Composer is vulnerable to Command Injection via Malicious Perforce Repository
- CVE-2025-67746 Composer vulnerable to ANSI sequence injection
Sources
Also known as BIT-composer-2021-41116, CLEANSTART-2024-SA12234, GHSA-frqg-7g38-6gcf, UBUNTU-CVE-2021-41116, openSUSE-SU-2024:11617-1, openSUSE-SU-2024:11874-1.