Description

Two high-severity security vulnerabilities have been identified in Composer, posing a risk of arbitrary command execution if exploited. These flaws affect the Perforce VCS (version control system) driver and could allow attackers to execute malicious commands in the context of the user running Composer. The vulnerabilities are tracked as CVE-2026-40176 (CVSS 7.8) and CVE-2026-40261 (CVSS 8.8). Both issues stem from improper input validation and insufficient escaping of user-controlled data. The first vulnerability, CVE-2026-40176, allows attackers to inject arbitrary commands by manipulating repository configuration within a malicious composer.json file that declares a Perforce repository. The second, CVE-2026-40261, involves crafted source references containing shell metacharacters, enabling command injection through inadequate input sanitization. Notably, Composer may execute these injected commands even if Perforce VCS is not installed on the system, increasing the potential attack surface. These vulnerabilities impact versions 2.9.6 and 2.2.27 respectively. Users are strongly advised to update Composer immediately to patched versions. If patching is not feasible, precautionary measures include carefully reviewing composer.json files, validating Perforce-related configurations, and limiting usage to trusted repositories and sources. Additionally, it is recommended to avoid installing dependencies using the --prefer-dist option or the preferred-install: dist setting. While Composer maintainers reported no evidence of active exploitation on Packagist, they have disabled publication of Perforce metadata as a preventive step.