Composer Fixes Two Perforce Driver Flaws That Enable Command Execution

· Original article ↗

Summary

Two Composer Perforce VCS driver flaws, CVE-2026-40176 and CVE-2026-40261, could enable arbitrary command execution. Fixed releases are 2.9.6 and 2.2.27; Packagist disabled Perforce source metadata as a precaution.

Key points

  • CVE-2026-40176 and CVE-2026-40261 are command-injection flaws in Composer’s Perforce VCS driver.
  • A malicious repository configuration or crafted source reference could inject commands that run in the context of the user running Composer.
  • The commands can execute even when Perforce is not installed.
  • Affected versions are 2.3 through before 2.9.6, and 2.0 through before 2.2.27; fixes are available in 2.9.6 and 2.2.27.
  • If unable to update immediately, inspect composer.json files, use trusted repositories and projects, and avoid dist installs as advised in the article.
  • Composer reported finding no evidence of exploitation through malicious package metadata; Packagist disabled Perforce source metadata as a precaution.

Article Details

Vulnerability Types
  • Command injection
  • Improper input validation
Severity
High; CVSS scores 7.8 and 8.8
Affected Versions
  • Composer >=2.3, <2.9.6
  • Composer >=2.0, <2.2.27
Exploitation Status
not_reported
Exploit Availability
unknown
Patch Status
available
Workarounds
  • Inspect composer.json files before running Composer and verify that Perforce-related fields contain valid values.
  • Use trusted Composer repositories and run Composer commands only on projects from trusted sources.
  • Avoid dependency installation with --prefer-dist or the preferred-install: dist configuration setting.

MITRE ATT&CK

CVE

Products

Related Articles