Arbitrary Command Execution in Composer via Malicious Perforce Source URLs
Composer versions before 2.10.3 and 2.2.30 are vulnerable to remote code execution when the Perforce CLI client is installed and a malicious package metadata source URL is processed (CVE-2026-84361).
CVE search metadata
CVE search record: CVE-2026-84361. EPSS: 0.41%. KEV: no. Product: composer (>= 2.3.0, < 2.10.3), composer (>= 1.0, < 2.2.30). Brief: Arbitrary Command Execution in Composer via Malicious Perforce Source URLs. Brief link: https://feed.craftedsignal.io/briefs/2026-09-composer-rce/
Composer, a dependency manager for PHP, contains a vulnerability (CVE-2026-84361) that allows for arbitrary command execution when the Perforce (p4) CLI client is installed on the local system. The vulnerability exists because Composer fails to properly sanitize Perforce source URLs defined in package metadata before passing them to the p4 command-line utility. Attackers who can control a package's source metadata - typically by utilizing private/third-party Composer repositories or untrusted composer.lock files - can provide specially crafted strings that the p4 client interprets as local system commands rather than network connection endpoints.
This flaw impacts developers and CI environments where the p4 client is present on the system PATH. When composer install or composer update is executed against a malicious repository or lock file, the commands injected via the Perforce source URL are executed with the privileges of the user running the Composer process. This vulnerability was addressed in Composer versions 2.10.3 and 2.2.30.
Impact
Successful exploitation allows for full command execution on the target host, leading to system compromise, data theft, or lateral movement within build environments. The impact is highest in CI/CD pipelines where Composer processes untrusted dependencies, potentially compromising the entire development and deployment lifecycle. Organizations that do not use Perforce but have the p4 CLI client installed on developer machines or build agents are also at risk.
Recommendation
- Upgrade Composer to version 2.10.3 or 2.2.30 or later to ensure proper validation of Perforce source URLs.
- If upgrading is not immediately possible, remove the
p4binary from the systemPATHof all environments running Composer. - Audit custom or third-party Composer repositories to ensure they are trusted and secure.
- Treat
composer.lockfiles obtained from external, untrusted sources with extreme caution. - Restrict the use of the
--prefer-sourceflag in untrusted environments.
Immediate actions
Upgrade Composer to version 2.10.3 or 2.2.30
Remove p4 CLI client from PATH on systems not requiring Perforce
Mitigations
Remove p4 client from system PATH
CVE-2026-84361