A security flaw in Composer, the PHP dependency manager, can run attacker-supplied commands when a developer or build job opens a specially prepared project, even with a seemingly read-only command such as composer show. Fixes are available in Composer 2.11.3 and the 2.2.33 long-term-support release.
The Composer maintainers’ advisory, published November 24, describes a bypass of an earlier security fix. On November 30, researchers at Orca Security published a technical explanation and warned that some build images still contained vulnerable versions when tested.
The attack requires control over both a project’s composer.json and its vendor directory, and a victim must run a vulnerable Composer in that project. It is not a remote attack against a PHP website merely because that site uses Composer, and the advisory does not describe exploitation through an ordinary package installation alone.
Which Composer versions are affected?
The advisory lists versions 2.2.23 through 2.2.32 and 2.7.0 through 2.11.2 as affected. The upstream fixes are 2.2.33 for the LTS line and 2.11.3 for the current line. The issue is tracked as GHSA-374h-4mh9-7rpm; the advisory lists no known CVE as of December 1.
Check the Composer actually used on each developer machine, build runner and container, not just the version specified in project documentation. From a trusted directory, run composer --version. Check the executable’s source too: a system package, a downloaded PHAR and a container image may each need a different update.
For the official PHAR installation, Composer’s self-update command can update the executable; select the appropriate supported release and verify the version afterward. For a distribution-managed package, use the distribution’s update process and security tracker instead of assuming the upstream version number alone tells the whole story. Debian’s tracker for this advisory lists the status by release, including backport status.
Why a package listing can execute code
Composer loads a PHP file containing installed-package information from the project’s vendor directory. According to Orca’s analysis, vulnerable releases checked that file for allowed content, then substituted a project-controlled directory path into it before evaluating the result. A crafted path could turn content that passed the first check into executable PHP during that substitution.
The patched releases check the transformed content again before evaluating it. The attack can be delivered through an untrusted checkout, a shared project directory or a pull request containing the necessary files. Orca demonstrated it with commands including show, list and validate, as well as install.
The maintainers list running without --no-plugins and without --no-scripts among the conditions for this specific flaw. Orca found either flag prevented its demonstrated path. Treat those flags as a temporary mitigation for this issue, not a guarantee that an untrusted project or its build is safe. Update Composer and isolate untrusted work.
Check CI jobs before they load a project
A build job can turn a malicious pull request into execution under the runner’s identity. The consequences depend on what that particular job can access: an unprivileged job may have limited credentials, while a privileged job could expose tokens, secrets, caches or artifacts.
Review workflows that check out contributor-controlled code and invoke Composer, including validation and dependency-inspection steps. Pay particular attention to pull_request_target or workflow_run jobs that explicitly check out untrusted pull-request code. GitHub Security Lab’s guidance recommends running untrusted builds in an unprivileged workflow and handling any results passed to a privileged workflow as untrusted data.
- Update or pin Composer in runner images, Dockerfiles and setup steps before any command processes an untrusted project. Recheck the version in the job log after the setup step.
- Keep secrets out of jobs that build untrusted contributions, restrict token permissions and avoid persisting checkout credentials where they are not needed.
- Review caches and artifacts crossing from untrusted builds into release jobs. A successful build does not make its output trustworthy.
- Use isolated, disposable environments for unfamiliar projects, and review changes to
composer.jsonand committed vendor files before running tools against them.
Orca’s runner-version observations are a snapshot, not a promise about every current image. Hosted images and pinned setup actions change independently, so inspect the actual job environment. Updating Composer removes this particular flaw; it does not make it safe to execute untrusted pull-request code with production credentials.