Skip to content

Update dependency composer/composer to ^2.9.6 [SECURITY] - autoclosed#992

Closed
renovate[bot] wants to merge 1 commit into8.21.xfrom
renovate/packagist-composer-composer-vulnerability
Closed

Update dependency composer/composer to ^2.9.6 [SECURITY] - autoclosed#992
renovate[bot] wants to merge 1 commit into8.21.xfrom
renovate/packagist-composer-composer-vulnerability

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate bot commented Apr 14, 2026

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
composer/composer (source) ^2.9.5^2.9.6 age adoption passing confidence

GitHub Vulnerability Alerts

CVE-2026-40261

Impact

The Perforce::syncCodeBase() method appended the $sourceReference parameter to a shell command without proper escaping, allowing an attacker to inject arbitrary commands through a crafted source reference containing shell metacharacters. Further as in GHSA-wg36-wvj6-r67p / CVE-2026-40176 the Perforce::generateP4Command() method constructed shell commands by interpolating user-supplied Perforce connection parameters (port, user, client) without proper escaping from the source url field. Composer would execute these injected commands even if Perforce is not installed.

The source reference and url are provided as part of package metadata. Any Composer package repository can serve package metadata declaring perforce as a source type with a malicious source reference or source url. This means the vulnerability can be exploited through any package served by a compromised or malicious Composer repository. An attack does not require Perforce to be installed on the client, as Composer will attempt to execute the constructed command regardless.

This vulnerability is exploitable when installing or updating dependencies from source (--prefer-source, default when installing dev prefixed versions), even if you do not use Perforce.

Patches

Fixed in Composer 2.2.27 (2.2 LTS) and 2.9.6 (mainline)

Note, the fix for the source url in the Perforce::generateP4Command() was addressed as part of the patches for GHSA-wg36-wvj6-r67p / CVE-2026-40176 in the same versions.

Workarounds

  • Avoid installing dependencies from source by using --prefer-dist or the preferred-install: dist config setting.
  • Only use trusted Composer repositories.

CVE-2026-40176

Impact

The Perforce::generateP4Command() method constructed shell commands by interpolating user-supplied Perforce connection parameters (port, user, client) without proper escaping. An attacker controlling a repository configuration in a malicious composer.json declaring a Perforce VCS repository could inject arbitrary commands through these values, leading to command execution in the context of the user running Composer. Composer would execute these injected commands even if Perforce is not installed.

VCS repositories are only loaded from the root composer.json file located in the directory you execute Composer commands in and from the composer config directory (e.g. ~/.config/composer/composer.json). So this vulnerability cannot be exploited through composer.json files of packages installed as dependencies.

You are at risk of command execution if you run Composer commands on untrusted projects with attacker supplied composer.json files, regardless of whether you or any of your dependencies use Perforce.

Patches

Fixed in Composer 2.2.27 (2.2 LTS) and 2.9.6 (mainline)

Workarounds

  • Carefully inspect composer.json files before running Composer on them. Verify that Perforce-related fields contain valid values.
  • Only run Composer commands on projects from trusted sources.

Release Notes

composer/composer (composer/composer)

v2.9.6

Compare Source

  • Security: Fixed command injection via malicious Perforce reference (GHSA-gqw4-4w2p-838q / CVE-2026-40261)
    • Security: Fixed command injection via malicious Perforce repository definition (GHSA-wg36-wvj6-r67p / CVE-2026-40176)
    • Security: Fixed git credentials remaining in git mirror .git/config after clone or update failed (2bcbfc3)
    • Security: Fixed usage of insecure 3DES ciphers when ext-curl is missing (5e71d77)
    • Security: Fixed Perforce unescaped user input in queryP4User shell command (ef3fc08)
    • Security: Hardened git/hg/perforce/fossil identifier validation to ensure branch names starting with - do not cause issues (6621d45, d836b90, 5e08c76)
    • Fixed inconsistent treatment of SingleCommandApplication script commands wrt autoloading (#​12758)
    • Fixed GitHub API authentication errors not being visible to the user (#​12737)
    • Fixed some platform package parsing failing when Composer runs in web SAPIs (#​12735)
    • Fixed error reporting for clarity when a constraint cannot be parsed (#​12743)

Configuration

📅 Schedule: (in timezone UTC)

  • Branch creation
    • ""
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

Read more about the use of Renovate Bot within ocramius/* projects.

| datasource | package           | from  | to    |
| ---------- | ----------------- | ----- | ----- |
| packagist  | composer/composer | 2.9.5 | 2.9.6 |
@renovate renovate bot added the security label Apr 14, 2026
@renovate renovate bot changed the title Update dependency composer/composer to ^2.9.6 [SECURITY] Update dependency composer/composer to ^2.9.6 [SECURITY] - autoclosed Apr 15, 2026
@renovate renovate bot closed this Apr 15, 2026
@renovate renovate bot deleted the renovate/packagist-composer-composer-vulnerability branch April 15, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants